General information
Category:
Forms & Form designer
>I've always thought it would be cool if I could know what control was about to get focus (within the control that currently has focus), regardless of how the focus is being changed (ie: mouse, keyboard, or programmatic).
Well, this is the only way I can think of off hand, maybe something to add to your framework, who knows:
Programmatic: In the baseclass of all your controls, add this to SetFocus:
thisform.oProgrammaticMoveFocus = this
and in the GotFocus .NULL. it out. You can look at this property in the Valid to tell you where focus is going next, since the SetFocus() method finishes before the Valid() of the current control fires.
Mouse: If oProgrammaticMoveFocus is NULL, you'll know it was either a keyboard or mouse, you can test for mouse with MDown() and then grabbing sys(1270).
Keyboard: Otherwise, you can test in the valid f lastkey was enter, backspace, tab or back tab, pass This.TabOrder + or - 1 (depending on the key) to find the next control (remember to test for containership)
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only