Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do you get a textbox to keep the focus ?
Message
 
 
À
29/12/1997 13:22:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00068247
Message ID:
00068273
Vues:
19
>>>>>>I have a textbox that is used to enter a search string.
>>>>>>After the search string text has been entered, and the enter button is pressed, the focus moves to the next object on the form.
>>>>>>How do I get this textbox to "keep the focus" after the enter key is pressed, so that another search string can be entered. ?
>>>>>>(What exactly do I type, and where do I place this code? )
>>>>>>
>>>>>>Your help would be greatly appreciated.
>>>>>
>>>>>You can try putting RETURN .F. in the VALID Event of the TextBox
>>>>
>>>>Thanks, I have tried this and it solves the problem.
>>>>Now the only problem is that when I do decide to leave the textbox by clicking somewhere else on the form, I get a wait window message "Invalid Input". Any ideas on this ? (Thanks, I'm new to VFP)
>>>
>>>try RETURN 0 (zero). I would do the following:
>>>if lastkey()=13   && test for the ENTER key being hit
>>>   return 0
>>>endif
>>
>>also, because the valid now tests for lastkey(), lastkey() will always be 13 until another KEYSTROKE. Mouse clicks do not reset this. So clicking on another object (close button, command button, etc.) will not work until you hit some other key like the tab, one of the arrow keys, etc. Focus will remain in the textbox until you do so. You could use a KEYBOARD command before the RETURN 0 above, but it would have to be something that would not shift focus from the textbox.
>
>
>You could try something like this:
>
>txtBox.GotFocus()
>thisform.setall('TabStop',.f.)
>** this will not prevent the mouse from selecting another control.
>** but will not allow the cursor to move into another control.
>
>
>in all the other controls:
>control.GotFocus()
>thisform.setall('TabStop',.t.)

Too much coding. Maybe thisform.setall('TabStop',.t.) in LostFocus of original textbox. This still lets you leave textbox with the ENTER key which is what he doew not want to do.
Mark McCasland
Midlothian, TX USA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform