Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using a Control (or a container) to validate its content
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00030015
Message ID:
00030026
Vues:
57
>>>>>>>I am trying to create my own custom controls using both the Control and Container object. I am using the LostFocus event to validate my custom control by setting the focus back into the control if it is not valid. This almost works, but like usual VFP has to spoil things. Checkboxes can still be checked outside of my control and the Form can be closed even if the data is invalid.
>>>>>>>
>>>>>>>Does anyone have a sure solution to the VALIDATION OF A CONTROL OR CONTAINER?????
>>>>>>>
>>>>>>>
>>>>>>>TIA,
>>>>>>>Peter
>>>>>>>
>>>>>>>btw, my control is a date picker control.
>>>>>>
>>>>>>Yes, use the VALID event, not LOSTFOCUS.
>>>>>>
>>>>>>Vlad
>>>>>
>>>>>BUT, a Container and Control object do not have Validate events.... So I can,t use that event!!!!
>>>>>Peter
>>>>
>>>>But the objects contained in the control have Valid events. Why can't you use them?
>>>>
>>>>Vlad
>>>
>>>For example I allow the blanking of my date field. If I used the embedded textbox control validation the moment I blanked a month but still had a day and a year the months Valid would return .f. because " /12/1997" is not a valid date. So instead I allow blank month, day, or year and check to see if they are all blank or all filled when focus is lost from the container.
>>>
>>>Hope this clarifies the situation.
>>>Peter
>>
>>Not really... So, you will accept a date without month, day or year, isn't it?
>>
>>Vlad
>No, I will accept all full or all empty. That's not the point--the point is that I need to validate at the container level for not only this control but others as well. So, do you know of any way to validate at the container level??
>Peter

Why you don't fill the others sections of your date field with something valid?

If the user take the 'Year' part in your date picker you can fill the day and month with '01' if those parts are empty...?
If we exchange an apple, we both get an apple.
But if we exchange an idea, we both get 2 ideas, cool...


Gérald Santerre
Independant programmer - internet or intranet stuff - always looking for contracts big or small :)
http://www.siteintranet.qc.ca
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform