Wiki Home

QueryUnload


Namespace: SQL
Syntax: PROCEDURE form.QueryUnload

Culled from VFP Help:
Occurs before a form is unloaded, before the Destroy and Unload events. The form's Release Type property is set prior to the QueryUnload event being called, and indicates roughly what happened to trigger the event.

The QueryUnload event occurs when CLEAR WINDOWS, RELEASE WINDOWS, or QUIT is executed in code, or when the user double-clicks the window pop-up menu icon or chooses Close from the window pop-up menu on a form.

The QueryUnload event does not occur when a form's associated variable is released, if you issue the RELEASE command on the form in code or invoke the form's Release method.

Issuing NODEFAULT in the QueryUnload event procedure prevents the Destroy and Unload events from firing, thus preventing the form from unloading.

From the Hackers Guide:

It's the place to double-check that the user really wants to close the form and to give her a chance to save her work before closing.

...

The Release Type property indicates how a form is being closed. It's set before QueryUnload triggers, so you can investigate in the QueryUnload method and take different actions based on the reason the form is closing.

...

You'll normally want to integrate QueryUnload for individual forms with an application's ON SHUTDOWN routine. That way, when a user closes your application by double-clicking in the main window, she'll get a chance to save her work in open windows.


Does anyone know what "double-clicking in the main window" means? -- Carl Karsten
If you double-click the Fox icon (or any app's icon) in the upper left corner, that's equivalent to closing the app. It's a throwback to before we had the X in the upper right corner. -- Randy Pearson
An edit we never finished. < g> Double-clicking the controlbox in the main window, that is, the upper left corner where the app's icon is. -- Tamar Granor
Category VFP Events Category Exam 70-155 Hot Topic
( Topic last updated: 2006.12.08 10:52:51 AM )