Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Form.release question
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00228761
Message ID:
00228958
Vues:
18
>>>>>I don't like using Destroy - it's too late to stop things at that point...
>>>>
>>>>Okay...that is a personal thing...but in this case, if I were arguing, I would contend that if we are issuing a CLEAR EVENTS, we know that we are done with this form...but I am not arguing...
>>>>
>>>>I am not saying that code in the QueryUnload procedure might not be needed, just that the CLEAR EVENTS could go in the Destroy procedure.
>>>>
>>>>Anyways, just a matter of taste.
>>>
>>>This is true, there's more than one way to handle it - I just prefer to keep all related exit code in one place, and the Queryunload is the optimal place for that...no need for either Release or Destroy code, then...
>>
>>The QueryUnload event does not occur if you issue the RELEASE command on the form in code or invoke the form's Release method.
>>
>>Doesn't this mean that if the user presses the button with RELEASE THISFORM in its click procedure, the form's QueryUnload procedure will NOT be performed?
>
>In the click procedure, you just call the Queryunload, which has all the exit code in it...

I see. I personally find it more intuitive to do things in the Destroy procedure. Then you don't have to remember that everywhere and anywhere in your code you release the form, you have to first run Queryunload. There may be times when you only want to run code when the user closes the form by other than a Release; this is where you would use Queryunload. But when you want to run code everytime the user closes the form, no matter how the closing is done, I think it should go in the Destroy procedure. That is why the event is available to us.

Don't you think there is a danger that somewhere down the road another programmer will add a button to the form that is a new option and does something and then performs a Release on the form? If he/she is not aware of the code in Queryunload, the code will not be run and that is obviously a problem. I just see no advantage to using Queryunload over Destroy in this case, and I see a disadvantage. I am assuming that I understand the situation correctly.

Take care,
Joe
Joseph C. Kempel
Systems Analyst/Programmer
JNC
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform