Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Menu Shortcuts
Message
From
19/12/2000 14:39:39
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
Miscellaneous
Thread ID:
00454279
Message ID:
00455155
Views:
31
Donu:

Add a CustomValid method to all your control base classes and add this code to the Valid event:



Local luRetVal

If LastKey() = 17
Return .T.
EndIf

luRetVal = This.CustomValid()

If Empty(luRetVal) Then
Thisform.SaveDenied = . T.
Return .F.
Else
thisform.SaveDenied = . F.
EndIf


Return ( luRetVal )

and leave the CustomValid method blank at the class level. Put all your control validation rules in the CustomValid method of your controls, and not in the Valid event (think of the Valid code as a program flow director). Leaving the Valid event empty at the control level ensures that your "Escape" condition is always fired and remove the need to add a DoDefault at the beginning of every enhanced Valid.

If you are still not sure about this, try:
1. Create a textbox class as above.
2. Create a form and add a few instances of this class on the form.
3. Put all kinds of silly validation rules in CustomValid for about half your textboxes.
4. Put the validation rules in the Valid event for the remaining control.
5. Test your form for Escape.

I think it will become clear.


Daniel
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform