Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VALID() and the Cancel Button
Message
 
To
02/04/1998 10:12:55
Rex Mahel
Realm Software, Llc
Ohio, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00088942
Message ID:
00088953
Views:
22
>All,
>
>This has been a problem forever, but mayby someone has a new idea. How do you code Valid clauses to allow the user to press a Cancel button and not have to validate the current field (VFP5.0)? I hope there is a method or event which fires after the mousepress but before the Valid.
>
>Any ideas?
>
>Thanks
>
>Rex
Mahel,

There are a million ways to deal with this, the simpleest is to set the Cancel property of your Cancel button to .T. (which makes clicking that button equivalent to pressing the escape key). Then start off all Valid code with;
IF LASTKEY() = 27 && escape
   RETURN .T.
ENDIF
That's it, no more no using sys(1270) to find out the name of the object the mouse is over, no fancy coding all over the place. You simply make the Cancel button the Escape button and the check in your valid code to see if the user pressed escape. This not nly works but is eliminates the question of "How do stop the user from closing my form with the escape button?" Because pressing the escape key is the same as clicking teh cancle button and pressing escape will run the click code of the cancel button and do all those thing you've set up for cancelling.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform