Information générale
Catégorie:
Gestionnaire d'écran & Écrans
>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)
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement