>>Now I have another question... I may want to let the user leave the field that I'm validating with incorrect data _if_ they are hitting the "cancel" button.
>
>Make sure you set the Cancel buttons Cancel property to .T.
>
>Then, in your Valid(), put:
>
>
if lastkey() = 27
> return .t.
>else
>
>endif
>
>because if you press a cancel button, it makes the last key equal to hitting the escape key.
Hello,
I tried it too and it doesn't work properly. I have new form, one textbox with valid method described above, and two buttons - OK and Cancel, both doing ThisForm.Release in Click method, but the Cancel buton has the property Cancel=.t., while Ok has not. I run the form and click the Cancel with mouse. Valid gets lastkey 27 (I see it in my wait window message) and loses focus. Then the Cancel button gets focus, but the release of the form is not executed. If I hit the Cancel button once more, then it releases. What am I doing wrong?
(Form is modal).
Thanks for explanation
Petr