HI,
I have a complexe UI with Multiple Usercontrols that are depending on each other. So when I change the value of one item I have to do a recalc to all other controls. Each controls checks if it depends on the latest modifications and then recalcs itslef (means loads rowsource, default value and so on).
This works fine but in the case of UltraCombo sometimes the popuplist does not closeup after click? I did allready put the recalc-Method into a separate thread. This made it better but there are still remaining lists that stay "open" after click.
I am using Infragistics.Win.UltraWinGrid.UltraCombo. Here is my code:
private void OnComboEditorValueChanged(object sender, EventArgs e){ if (this.inRefresh == true) return;
if (this.boundParameter == null || this.comboEditor.Value == null) return;
this.boundParameter.Value = this.comboEditor.Value; if (!this.boundParameter.SuppressRecalc && this.boundParameter.Modified) { if (this.boundParameter.Locked) DoRecalc(); else if (this.boundParameter.RecalcLockedOnly == false) DoRecalc(); }
Application.DoEvents();}
public void DoRecalc(){ if (this.inRefresh) { return; } if (this.boundParameter != null) { System.Threading.Thread t = new System.Threading.Thread(this._doRecalc); t.Start(); }}
public void _doRecalc(){ this.boundParameter.Funktionseinheit.Recalc();}
Any ideas how I can force the Ultracombo closeup?
Kind Regards and have a nice Easter Weekend.Patrick
Hi Patrick,
There is a CloseUp method on the control, I think, so you could use that to work around the issue.
But the combo closes up automatically when you click on an item to select it. So if it's not closing up, I'd probably try to find out what's stopping it rather than work around it by closing it up manually.
My guess is that the control is somehow losing the MouseUp message because you are doing something in the MouseDown, or else it has something to do with the threading you are doing.
Hi Mike,
no there is not closeup method available to the control. The control is a UltraWinGrid.UltraCombo. I am using this within a usercontrol. There are no event handlers on mouseDown, -Up or -Move. The only events I am listening are:
I don't think, that this behavior is an effect of threading. Because I did the threading things as workaround. I first worked with ComboEditor. But since multicolumn dropdownlist is required I changed to ultracombo and here I experienced this behaviour. So I tried out threading. This made it better but there are still remiaining situations where the dropdown list remains "un-closeup-ed".
Kind Regards
Patrick
That's weird. I've never seen a case where the combo doesn't close up when you select an item. Are you able to reproduce this behavior reliably? If so, I'd love to see a small sample project where this occurs so I can check it out and figure out why it's not closing.
sorry for the delay. There have been some other urgent issues. Assuming that this behaviour was an specific issue of my project, it took a long time to reduce the problem from to its kernel.
Fortunatly I succeeded and now I am able to reproduce it within a normal small project. The problem is, that when I code is executed from the OnValueChanged event, and this code takes a while and therefore sends events to the GUI, then the combobox does not closeup. This is just the same behaviour as I experienced in my project and I hope that it would be the same solution to get rid of it.
Attached you will find a small project. You can reproduce this isssue when you change the value of the first combo. This affects some reloading of the second combo. In this case I load 10000 items to the second combo but this is only to spend enought time. In my project this is not as much but I have a complexe object model with a hundred properties. Each of them checking if its dependent control values have changed and if yes recalculate itself. So the time for one recalc can be 2 seconds and this is why a progressbar is displayed in the GUI.
Hope this helps to reproduce the error and that we will find a solution for it.
Kind regards
The problem here is that you are using a DoEvents statement.
DoEvents will often cause problems with event handling and mouse messages, and I believe that even Microsoft's Documentation warns against using it because it can cause problems just like the one you are having here.I have seen DoEvents cause problems with scrollbars, context menus, and dropdowns of all kinds.
My advice is to avoid DoEvents whenever possible.
Hmm, I removed all Application.DoEvents() from my Application and it seemed to work. Then I took the recalculation back to the original thread with the effect, that the Combo does not closeup now.
The threading issue was created as a trial to workaround the not closeup thing.
Now I am at the same point as before. Any other idea, what's happening?
Regards
I think I found the reason but do not see a possible solution. I do the recalculation in the same thread which is more secure because the gui is locked while recalculation. But what I can see is, that the Combo takes while until CloseUp. I think ths is only done after the recalculation which is performed from within the OnValueChanged Event has finished. And often during Recalculation the user is displayed a messagebox. If the messagebox was showed the comboBox does not closeup.
This is to be reproducable with the dummy application I sent some posts before.
What can I do for this issue and what can I do to get the progressbar updated? This is why I introduced the DoEvents.
Ok I did id using BeginInvoke and it works on my machine. So I hope to see same effect on the clients site where the application runs in a terminal server environment.
I'll come back to here after I verified this (unfortunatly after 15th of June)
Thanks for your patience until here...
I'm not really sure I understand exactly what you are doing or where the second thread comes into this.
But one thing you might try is calling the ReCalc method using a BeginInvoke instead of directly inside the ValueChanged event. This way, the Combo will finish processing it's own event notifications and close up before the calculation process begins.