Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bypass Validation when a Cancel button is pressed.
Message
 
To
10/11/1999 03:18:15
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00288499
Message ID:
00289491
Views:
52
Hi Cetin,

I could reproduce it as well. Dump that code into 2 textboxes, put:
thisform.textbox1.value = ''
thisform.textbox2.value = ''
into the cancel button and set .cancel = .t..

Now Click in textbox1 then click in textbox2, the valid works as expected.
Click in textbox1 type some text and then hit ESC, works as expected (no message). Now click back in textbox1, then click textbox2 (even though textbox1 is blank you don't get the messagebox). I think what is happening is the LASTKEY() is still returning 27 so the valid is failing.

My workaround was to put a keyboard{space} in the cancel to reset lastkey().

>>VALID EVENT
>>* first check
>>IF LASTKEY()=27
>> RETU
>>ENDIF
>>*second check
>>IF ISBLANK(THIS.VALUE)
>> MESSAGEBOX('blank')
>> RETU .F.
>>ENDIF
>
>
Rajni,
>To be able to help I should reproduce it but I can't. It works as intended. I suspect there is another code causing it. Also I noticed a sentence in your original post "When the Cancel button is pressed it clears the text from both of the text boxes without doing any validations. ". Why an Esc cause clearing of both textboxes. There should be some other code doing it unless both textboxes are bound to same controlsource such as a memvar.
>Cetin
Roi
'MCP' Visual FoxPro

In Rome, there was a poem.
About a dog, who found two bone.
He lick the one, he lick the other.
He went pyscho, he drop dead!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform