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

# TCustomForm.DoClose

Notifies handlers of the close action for the form.

## Declaration

Source position: forms.pp line 640

`protected procedure TCustomForm.DoClose(`
`var CloseAction: TCloseAction`
`); virtual;`

## Arguments

`CloseAction` |  | Close action to perform for the from instance.

## Description

DoClose is a method used to notify close handlers for the form instance of the action requested in the CloseAction parameter.

It is called from the Close method for a form that is not displayed as a modal dialog; i. e. FormState does not contain fsModal. It occurs after CloseQuery (and OnCloseQuery) have been called to determine if the form can in fact be closed, and the CloseAction has been set for the form style.

DoClose signals the OnClose event handler (when assigned) to allow the form instance to modify the CloseAction argument. It iterates over the close handlers in the form instance, and signals each of the TCloseEvent instances in the method list using CloseAction as an argument.

## See also

TCustomForm.OnClose |  | Handler called when the form is closed. It determines what happens to the form (destroy, hide, etc.).
TCustomForm.Close |  | Closes the form.
TCustomForm.CloseQuery |  | Asks the OnCloseQuery handler whether the form can be closed.
TCustomForm.OnCloseQuery |  | Event handler signalled when trying to close a form.
TCustomForm.FormState |  | State flags for the form.
TCustomForm.FormStyle |  | Indicates the style for the form.
TFormHandlerType |  | TForm Notification handler types.
TCloseEvent |  | Type used for an OnClose event handler in a form.