Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to avoid valid if user select cancel button?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00206159
Message ID:
00206735
Vues:
18
>>>If I have a field to validate on a form, I don't want to test the entered data if the user click on a cancel button.
>>>Is it possible to trap where the user click when we are in the valid of the field?
>>>
>>>Thanks.
>>>Eric.
>>
>>Eric,
>>
>>SEt the cancel proeprty of teh button to .T. and in the valid put this code first;
>>
>>
>>IF LastKey() = 27
>>   RETURN
>>ENDIF
>>* Your valid code goes here
>>
>
>I've have a similar scenario - BUT I'm not allowed to set the cancel property!! Any ideas?




For me, I would suggest to add some code before normal validation test!
(As Jim Booth mention)

But user may use Mouse to Click "Cancel" instead of press ESC...

In my view, if user make Empty String as return,
I would suppose user "Cancel Add/Edit" action, and thus tablereV()
with backing to non-add/edit status form interface.

Similarly, for printing, when user press "Cancel" on Getprint() function,
What I thought is user want to cancel Printing!

So, if Getprinter() return empty, Skip all printing coding!!
Else there will come an error if user click cancel on that dialog..

e.g. this code is simplest but suppose user not to click "cancel"

Set Printer to Getprinter()

but following code consider cancel button is pressed!
PR = Getprinter()

if Empty("&PR")
   Return
Else
   PrintJob
      * printing code ...
   EndPrint
Endif
P.S. the above code is based on VFP 5.0

for VFP 6.0, you can use Set("Printer", 3) to get back printer information!
The weak wait for chance, The strong bid for chance,
The clever notch up chance, but The merciful give you chance.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform