[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Forms' (#lcl)

# TCustomForm.OnClose

Handler called when the form is closed. It determines what happens to the form (destroy, hide, etc.).

## Declaration

Source position: forms.pp line 800

`public property TCustomForm.OnClose : TCloseEvent read FOnClose write FOnClose stored IsForm;`

## Description

OnClose is a TCloseEvent property which represents the event handler signalled when a form calls its Close or CloseModal method.

OnClose is triggered from the DoClose method immediately before calling any internal form handlers registered for the fhtClose form handler action type. OnClose can be used to determine the action performed in subsequent form handlers by setting the value in the CloseAction argument.

An application must implement and assign an object procedure using the signature for TCloseEvent to respond to the event notification.

## See also

TCustomForm.Close |  | Closes the form.
TCustomForm.DoClose |  | Notifies handlers of the close action for the form.
TCloseEvent |  | Type used for an OnClose event handler in a form.