Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

ReleaseType

This property sounds a lot more useful than we’ve found it. It tells you how a form was released so you can take different actions accordingly.

Usage

nReleaseType = frmForm.ReleaseType

ReleaseType gets set just before QueryUnload, so you can check it there or in the form’s Destroy or Unload method.

The descriptions in Help of what each value means are pretty limited. You get a ReleaseType of 1 in lots of cases, not just by clicking Close on the control menu or using the Close box. CLEAR WINDOWS or RELEASE WINDOWS sets ReleaseType to 1, too. Shutting down Windows, though, sets ReleaseType to 2.

The other descriptions are closer to reality, although you don’t have to actually release the variable referencing a form to get a ReleaseType of 0. Letting it go out of scope all by itself does the trick, too. Calling the form’s Release Method also sets ReleaseType to 0.

Example

* You might check whether you're leaving VFP entirely
* since some application actions are unnecessary in that case.
IF This.ReleaseType = 2
   WAIT WINDOW "Bye, now. Come again soon"
ENDIF

See Also

Destroy, QueryUnload, Unload