>>>>>Ed,
>>>>>
>>>>>>>...the sequence QueryUnload/Destroy/Unload is invoked by releasing the last object ref or RELEASE/CLEAR type commands issued outside the form or the default SHUTDOWN event for VFP.<<
>>>>>
>>>>>Releasing the last object ref to a form, or RELEASE/CLEAR commands issued outside the form do NOT fire either the RELEASE or the QUERYUNLOAD, in my testing. It jumps straight to Destroy.
>>>>>
>>>>>DO FORM test NAME oForm LINKED
>>>>>oForm=.NULL. *or* RELEASE oForm --> go straight to DESTROY.
>>>>>
>>>>>The default Shutdown, as you mentioned, does fire QueryUnload.
>>>>
>>>>It seems to on mine at least - put a NODEFAULT, thisform.Show() and a WAIT WINDOW 'Got to QueyUnload' in the QueryUnload and it'll fire - you may be ending up with a dangling object...
>>>
>>>Hi Ed,
>>>
>>>QueryUnload fires only under the following circumstances: CLEAR WINDOWS, RELEASE WINDOWS, or QUIT commands are encounter or the user selects the close option from the control menu or the use clicks the close (X) box. It doesn't fire when ThisForm.Release is issued. That's why any issuing of ThisForm.Release often is done in this fashion:
IF ThisForm.QueryUnload()
>>> ThisForm.Release
>>>ENDIF
>>
>>yes, I know that explicitly firing the Release or issuing the RELEASE WINDOW or CLEAR WINDOW
inside the form always fires release and doesn't fire QueryUnload...
>
>Nope, QueryUnload fires with RELEASE WINDOW or CLEAR WINDOW even fired from inside the form or any control on it.
I know there's some RELEASE that causes the Release to fire rather than QueryUnload; I'll have to dig around and find the example. You're probably right about CLEAR WINDOWS.