Does anybody faced with the following problem?
I created UltraNumericGrid with SpinEditorButton. In the event handler of the SpinEditorButton I'm showing Messagebox. But when message box is hidden, the other controls on the form (e.g. buttons) needs to be clicked twice to perform actions (test project is attached)
Thanks,
Alex
Hi Alex,
I ran your sample and I get the same results. The basic problem here is that the EditorSpinButtonClick event fires in response to the MouseDown message on the control.
So the control gets a MouseDown and then you show a MessageBox and it loses focus before it gets a MouseUp. It's still waiting for a MouseUp and it eats that next message.
To get around this, what you can do is avoid showing the MessageBox from the event handler directly. Instead, use a BeginInvoke to call a method that will show the MessageBox. This introduces a bit of a delay so the control can finish what it's doing before the MessageBox takes away the focus.
private void ultraNumericEditor1_EditorSpinButtonClick(object sender, Infragistics.Win.UltraWinEditors.SpinButtonClickEventArgs e) { //MessageBox.Show(this, "Test"); this.BeginInvoke(new MethodInvoker(this.ShowMessage)); } private void ShowMessage() { MessageBox.Show(this, "Test"); }
BTW, I also tried this out in the latest version of NetAdvantage (11.1) and the problem no longer occurs. So this was apparently fixed at some point. The new version of the control is probably watching to see if it loses focus during this process and assuming that it should not wait for a MouseUp at that point. So another option to avoid this problem would be to upgrade.