Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BINDEVENTS and stopping the event
Message
De
02/12/2003 19:25:09
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00855252
Message ID:
00855256
Vues:
15
>Hello,
>Lets say I have a piece of code that returns .T. or .F. depending on if it is okay to close a form or not. Now, the exit button on the form just calls the forms release method. So, I bind the click of the button to the IsOkToExit method on the form. The method, in this case, returns .F., how to I halt the execution of the button's code? Thanks,
>
>jfh

I wouldn't bind the event in this case.

You could wrap the call, e.g.
** exit button's Click() event
If thisform.IsOkToExit()
  thisform.Release()
EndIf
My preferred way of doing this is to put the IsOkToExit call in the form's QueryUnload(), then, even if the user clicks the 'x' to close the form it still halts the release, e.g.

just call the release in the button click
** exit button's Click() event
thisform.Release()
and let the QueryUnload() handle the exit approval
** QueryUnload()
Return thisform.IsOkToExit()
If the QueryUnload() returns .F., the form release is halted.
Insanity: Doing the same thing over and over and expecting different results.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform