Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Fooling the valid event of a control
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00510628
Message ID:
00511657
Views:
15
>OK, perhaps that's not the best title, but I'm looking for ideas here...
>
>I have a text box on a form for the user to type the date.
>
>The date is valid ONLY if it's < date() .and. > date() - 120
>
>The default value is blank. I NEED users to actually enter the date even if it's today.
>
>The problem I'm having is that if the user opens the form and decides not to input anything, and click on the CANCEL button, the text box's valid event fires, and until the user enters a date, he won't be able to cancel.
>
>If he presses the ESC key, he's able to leave the form and validation doesn't fire.
>
>Any way to bypass the valid event if the user clicks the Cancel button?
>
>Discuss amongst yourselves...
>
>Thanks!
Use the when event (dependent on the date value) to manage the selecteability of the other controls in the form. Instead of Valid use LostFocus to determine the propiety of the date. That way - cancel can fire any time. The Valid Paradigm is pretty narrow. We use combinations of When, InteractiveChange and LostFocus to control access and enabling of form controls. Almost every textbox has a when event. Some share the same function, others use combinations. Like:
procedeure MyTextBox.When
return OkayToSelect()
endproc
HTH

How can you be two places at once when your really nowhere at all?
Imagination is more important than knowledge
Previous
Reply
Map
View

Click here to load this message in the networking platform