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
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...
Kind regards
Patrick
Hi Patrick,
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.
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.
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
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.