Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Menu Shortcuts
Message
De
19/12/2000 14:39:39
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Titre:
Divers
Thread ID:
00454279
Message ID:
00455155
Vues:
32
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform