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

# TCustomForm.OnCloseQuery

Event handler signalled when trying to close a form.

## Declaration

Source position: forms.pp line 801

`public property TCustomForm.OnCloseQuery : TCloseQueryEvent read FOnCloseQuery write FOnCloseQuery stored IsForm;`

## Description

OnCloseQuery is a TCloseQueryEvent property which contains the event handler signalled to determine whether the form can be closed. Set the value in the CanClose argument to True to allow the form instance to be closed. The default value for CanClose is True.

Use OnCloseQuery to perform any actions or dialogs needed to confirm that the form can in fact be closed.

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

OnCloseQuery is signalled from the CloseQuery method, and occurs immediately after MDI child forms have called their CloseQuery methods.

## See also

TCustomForm.CloseQuery |  | Asks the OnCloseQuery handler whether the form can be closed.
TCustomForm.MDIChildren |  | Provides indexed access to MDI child forms when used as a MDI form.
TCloseQueryEvent |  | Specifies an OnCloseQuery handler event handler.