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:
00510634
Views:
14
This message has been marked as the solution to the initial question of the thread.
>>>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!
>>
>>Wouldn't a check for LASTKEY()=27 work in the valid?
>
>Hi Fred,
>
>If the user presses escape there's no problem. The valid event doesn't fire even though the focus is on the textbox at the moment, and the form is closed normally.
>
>The problem occurrs when the user clicks on the Cancel button on the form. Then, the valid event fires and focus returns to the textbox.
>
>Thanks!
>
>Alex

Yes, but if you have the Cancel property on your CommandButton set to .t., it shows up to LASTKEY() just like < Esc > was pressed.
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform