Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I clear LASTKEY()?
Message
 
To
03/06/2005 09:38:08
Mike Sue-Ping
Cambridge, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 6 SP5
Miscellaneous
Thread ID:
01019820
Message ID:
01019842
Views:
44
One of the solutions is to use something like

keyboard chr(1)

in that form unload event and to add

IF LASTKEY()<>27 and LASTKEY()<>1
...

in the textbox valid event.


>Hi,
>
>I have a "Cancel" button on the form that allows the user to throw away changes and simply quit the form. The "Cancel" button has it's Cancel property set to .T. and VFP internally sets LASTKEY to 27 when this button is clicked.
>
>I have some code in the valid of a textbox as follows:
>
>IF LASTKEY()<>27
> * Do some code validation here.
>ENDIF
>
>The trouble is that sometimes I have another form that is called from this textbox and the user can press ESC to close it causing LASTKEY to be set to 27! Now the textbox valid will not fire because LASTKEY()=27! Is there a way to get rid of the LASTKEY value or set it to anything else?
>
>I've thought about Keyboarding 2 Inserts (figuring that this would have no net effect while setting lastkey to not be 27), but it messes up the whole thing even more.
>
>TIA for any ideas and/or comments.
>
>Regards,
>
>Mike
Previous
Reply
Map
View

Click here to load this message in the networking platform