Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
QueryUnload or Release?
Message
De
24/11/2003 21:07:56
 
 
À
24/11/2003 20:58:16
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00853142
Message ID:
00853149
Vues:
19
Hi Hilmar,

Thanks. I gotit and that is what I ended up doing, however, in order to account for the user clicking on the close button, cancel button, etc or clicking on the form's 'X' button in the top-right corner, I am still calling the form's cleanup method from both the release and the queryunload method. Seems like duplication even if just the call to the method has to be entered in both. There must be a better way?


>I may be wrong, since the framework I use manages these nasty details. However, I think it would look something like this:
>
>In QueryUnload(): If the user confirms that he wants to exit, go ahead and run your cleanup code. Otherwise, I think you need to insert a NoDefault. In Release(), you must also call your cleanup code.
>
>I am not sure whether it is convenient to put all your cleanup code into Form.Release(), or whether you better create a separate cleanup method; I think the latter is the case. Actually, I think the cleanup code will only call ThisForm.Release() if some conditions are met, for instance: user confirms (if this is considered relevant) that he wants to exit; and there are no pending (unsaved) changes (for instance, if the user is asked "Save?" and replies by pressing the "Cancel" button, the changes will still be pending).
>
>HTH,
>
>Hilmar.
>
>>I have always used thisform.release in my command buttons that close a form so that I can access form properties if I need to before releasing all of the form's objects. However, I would like to allow the user to click on the 'X'in the top right hand corner of the form to also close the form and do some checks to determine if the form should be closed or not. Typically, this would be the same as pressing escape so I am prompting the user to exit the form or not and return to the form if necessary to continue editing so the user can save his changes. In testing, I noticed that clicking on the x does NOT run the form's release method, but queryunload. Hence, code that I had in the form's release method will have to be moved to queryunload. Yet calling queryunload from a command button does not seem to close the form. What is the best way to handle this? I don't want to put duplicate code in both queryunload and release...
>>
>>TIA!
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform