Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Valid code runs twice
Message
 
À
09/09/1999 12:28:31
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00262966
Message ID:
00262979
Vues:
22
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform