Hi,
I have a problem whith the ultraGrid.I am editing a string field, and while still editing, I click outside the grid such as I gice the focus to another component.The gridLostFocus event is not raised. (If I am editing in an UltraNumericEditor it works fine).Is that a know problem, or do I do something wrong ?
Thanks
Anne-Lise
Hi Anne-Lise,
What component outside the grid are you clicking on? Not all components take focus. If you click on a toolbar button, for example, the grid will not lose focus.
In any case, I would strongly recommend that you do not use LostFocus or GotFocus events on any control. These events are tied directly to Windows messages and they will give you all sorts of unexpected results. Microsoft's documentation advises against using them in DotNet, also. You should use Enter and Leave, instead.
Hi Mike, this is very useful for me. To test it, I just use
Private Sub UltraGrid1_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Ultra Grid1.Leave
MsgBox("testing Leave")
End Sub
And the only strange thing I notice is that the message appears twice... So Leave happens twice. Why could that happen? The only other Subs that I have programmed which handle other UltraGrid events are KeyPress, KeyDown and Enter...
It occurs with different sort of components which take focus:
If I use a ultraNumericEditor to edit in my cell it works (Grid lostFocus is correctly sent), but if I use default behavior to edit in cell or a ultraTextEditor it does not works (Grid lostFocus is not sent when another component take the focus).