Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Staying in a field
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00367421
Message ID:
00367444
Views:
34
>Hey all,
>I have one question about regular text boxes in VFP6
>My client would like us to make all forms so that when the enter key is pressed, the field does not loose the focus, however the tab key will move the focus to the next event.
>I have tried puttin a statement in my keypress event so that if the enter key is pressed it gives the focus back to the current object.
>This was not succesful I assume due to the fact that the focus is not passed until all methods are to completion.
>If any1 has a method of doing this or can whip one up real quick, Please let me know.
>
>Thanks in advance
>-Bruce



First, make sure you don't have any buttons on the form where the Cancel property is .T., or Enter will fire the click of that button.

In the LostFocus of the textbox put this code:
IF LASTKEY() = CHR(9)    && Tab
   DODEFAULT()
ELSE
   NODEFAULT
ENDIF
It sounds like it would be a good idea for you to make a specialized sub-class with this behavior, and to use that sub-class.
Previous
Reply
Map
View

Click here to load this message in the networking platform