Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using lostfocus to validate?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Using lostfocus to validate?
Divers
Thread ID:
00363607
Message ID:
00363607
Vues:
59
Hi all.

I've got a dilemma. (Which I am actually fighting in a lot of different places.)

Take a form and include a simple text box (or several) and some buttons including a cancel button.

For a text box, it needs to be validated and in certain conditions pop up a wait window or message box indicating problems with the value entered and possible solutions. If the cancel button is pressed, no validation should occur, the form should simply be cleared so the user can start over or closed.

The problem is that in the valid event for the text box, I have no way to know what is going on to trigger this event (did I just tab to the next field, or did I hit cancel?). So if I key in an invalid value, and then just hit cancel, I get whatever messages I have specified indicating this is an invalid value before the cancel code gets fired.

By moving the validation code into the lostfocus event I can set a flag in the when event of the cancel button so that my lostfocus routine knows that cancel has been pressed and will bypass the checks and not show any wait windows, message boxes, etc. The problem at this point is that if an invalid value is entered and I need to keep the user in that field, I can't make it work. I tried using a setfocus command, but it still ends up passing control to the next field.

I've struggled since my first day with VFP with the notion that every event seems to exist in a vacuum, when in reality what I want to happen in an event is dependant on what other events are pending (or exactly what my user did to leave this field.)

If anybody has a good solution to this dilemma, I would be very appreciative.

Thanks,
Paul
Paul R. Moon
Business Software Solutions
paul@businessoftware.com
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform