From RAD Studio API Documentation
Jump to: navigation, search


property OnClose: TCloseEvent read FOnClose write FOnClose;


__property OnClose;


Type Visibility Source Unit Parent
event published
FMX.Forms TForm


Occurs when the form closes.

FMX.Forms.TForm.OnClose inherits from FMX.Forms.TCommonCustomForm.OnClose. All content below this line refers to FMX.Forms.TCommonCustomForm.OnClose.

Occurs when the form closes.

Use OnClose to perform special processing when the form closes. The OnClose event specifies which event handler to call when a form is about to close. The handler specified by OnClose might, for example, test that all fields in a data entry form have valid contents before allowing the form to close.

A form is closed by the Close method or when the user chooses Close from the form's system menu.

The TCloseEvent type points to a method that handles the closing of a form. The value of the Action parameter determines whether the form actually closes.

The following table lists the possible values of Action:

Value Meaning


The form is not allowed to close, so nothing happens.


The form is not closed, but just hidden. Your application can still access a hidden form. This is the default value for Action.


The form is closed and all allocated memory for the form is freed.


The form is minimized, rather than closed.

By default, Action is set to caHide.

To close the form and free it in an OnClose event, set Action to caFree.

Note: When the application shuts down, the main form receives an OnClose event, but any child forms do not receive the OnClose event.

See Also