Sign in Join
FPDoc Onlineexperiment

TCustomForm.Release procedure

Member of TCustomFormpublicIn unit Forms

Marks the form for destruction.

Declaration

pascal
procedure Release

Description

Release is a procedure used to request destruction of the current form instance.

Release is called from the ShowModal method when a value other than mrNone is returned in the ModalResult property - including when the Application has been terminated while the dialog is active. While the method is public (just like in Delphi), it is not meant to be called from application code; ShowModal handles freeing the form instance in its processing loop. Calling Release when the form instance has already been freed in ShowModal raises an Access Violation (AV). You can use Close / OnClose to set the form close action to caFree to force the dialog to be closed and freed.

Release checks for a TApplication instance in the Application singleton. If it is assigned (contains a value other than Nil), its ReleaseComponent method is called to free the form instance by posting an asynchronous application message. When Application is not assigned, the Free method is called to destroy the form instance.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.