Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP5: Valid method vs LostFocus method
Message
 
To
07/05/1997 12:29:18
Jim Si
Alberta Research Council
Calgary, Alberta, Canada
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00031163
Message ID:
00031195
Views:
42
>Any ideas how I can activate the code whenever I hit tab key, arrow keys, enter key or double click on it?


Jim,

The problem is not in getting one of those events to fire all the time but rather in uderstanding when each of them fires and using them for that purpose. Valid fires when the value of the control has been changed and it is about to lose focus, valid can abort the focus loss by returning .F. or 0.

LostFocus fires when teh control has lost the focus, it is too late then to try and abort the loss of focus but you can call THIS.SetFocus() from there to put focus back on the control.

That said, you use the Valid to decide whether or not eh suer can leave the control (after they have changed the value). LostFocus is used to do whatever you need to do because they have LEFT. If you require to both validate their entry and to prepare for them moving on you would use both events each doing its job.

JimB
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform