As I understand it, you want the user to be able to click cancel on your form without firing the validation routines for whatever field they are on. here you can take advantage of the fact that when clicking a button, the Button's When event fires before the current controls lostfocus. So set a form property as a flag to whther the user is cancelling. In the When of the cancel button set the flag to true. Keep your validation in the Lostfocus of the textboxes, but only check them if the flag is false, in other words don;t check if the user is clicking the cancel button.
For example:
in the form init
this.lcancelling=.f.
In the textboxlostfocus
IF !thisform.cancelling && If the user hasn't clicked cancel
** do field validation here
ENDIF
In the cancel button When
thisform.cancelling=.t. && Which fires before the current textbox lostfocus
also in the cancel button, in the lostfocus
thisform.cancelling=.f.
--
Jerry
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement