Information générale
Catégorie:
Codage, syntaxe et commandes
>I have a form with two Text Boxes and two Command Buttons. One command button is an Ok button. I want to set the focus to the first Text Box if the validation routine on the Ok button fails. When I issue THISFORM.cTxtLoginName.SetFocus() in the Keypress() event of the Ok command button the focus goes to the first text box and then jumps to the next text box. If I change the set focus to the second text box the focus changes to the second text box then to the ok button. If I set the focus to the Cancel button the focus changes to the cancel button and then presses the cancel button. It is if an [enter] key is hanging around. I tried =INKEY(.005) prior to the SetFocus() command. but this did not change anything. Any ideas wou;d be appreciated. I am tired of being stuck...
Why not just put the setfocus() call from the CLICK() event of the Ok Button instead of the KeyPress(). But if it has to be in KeyPress(), you might try issuing a NODEFAULT after the setfocus() command.
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