beforeRelease
fires before the object has been released and is about to be destroyed.
Property of
Most dBASE form and data objects.
Description
Use beforeRelease to perform any extra manual cleanup, if necessary, before an object is released. beforeRelease fires when an object is about to be destroyed.
beforeRelease will fire under the following conditions:
When calling the release() method of an object
When issuing the RELEASE command
When an object is run without being assigned to a memVar then closing the object. This will destroy the object from memory causing the the beforeRelease event to fire.
when using a memVar that is assigned to one of these objects and subsequently releasing the memVar. Simply closing the object in this instance does not fire beforeRelease.
The beforeRelease event will fire in this case only when the memVar itself is destroyed either by using the RELEASE command, when the application is closed, or any other circumstance that results in the memVar being released from memory.
The order in which beforeRelease() fires for a Form and its contained objects is not strictly in the order in which these objects are released. In some cases, beforeRelease() will fire sooner than an object's actual release when it is notified by its parent object or by its associated datamodule, database, query, or storedproc object that it will soon be released.
The order in which objects on a form are actually released has not been changed from earlier versions of dBASE Plus except for subforms. Subform release has been moved from near the end of the release process up to the beginning of the release process.
One other change made is that removal of a form's code from memory has been moved later in the release process so that it occurs after all objects on the form have been released.
This is to prevent CLASS NOT FOUND errors that would otherwise occur if an object's beforeRelease property is set to a method of its form.
Here is the firing order for beforeRelease() when a form (or subform) is being released:
Subforms (if any)
Form Components contained in the form's elements array property (this includes any Contaner and Notebook objects and their contained objects)
Menubar assigned to Form's menufile property
Popup assigned to Form's popupmenu property
Form
Database (parented by the form). Each Database object (in turn) notifies any associated Query and StoredProc objects which in turn, notify their Rowset objects.
Any other objects assigned to properties or custom properties of the form and that are not in the form's elements array property. This includes:
Query or StoredProc objects parented directly to a form and NOT assigned to a database object
Datamodule objects on the form
Session objects on the form
Popup and menu objects parented by the form
Toolbar objects parented by the form
Arrays and other non-visual objects parented by the form