Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Valid code runs twice
Message
 
To
09/09/1999 12:28:31
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00262966
Message ID:
00262979
Views:
21
E.,

Your valid is firing twice because of the sequence of events;

1) User tries to leave
2) Valid fires
3) LostFocus fires
4) LostFocus calls SetFocus
5) to SetFocus focus must be lost first
6) Valid fires again
...

To get what you want do your chekcing in teh Valid event and RETURN 0 if the data is bad. Returning 0 from the Valid event prevents the LostFocus from ever firing and retains focus in the current control.

To understand these events use this;

Valid is to determine if the user is allowed to leave the field

LostFocus is used to react to the user leaving the field

If Valid says the user can't leave then LostFocus should not fire. LostFocus should only fire when the user is going to leave the control.

The same is true of GotFocus and When.

When is used to determine if the user will be allowed into a control

GotFocus is used to react to the user arriving at a control
Previous
Reply
Map
View

Click here to load this message in the networking platform