Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
QueryUnload or Release?
Message
From
24/11/2003 20:58:16
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
24/11/2003 20:16:44
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00853142
Message ID:
00853147
Views:
20
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!
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform