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

# TApplication.ControlDestroyed

Clears all references to the destroyed control.

## Declaration

Source position: forms.pp line 1600

`public procedure TApplication.ControlDestroyed(`
`AControl: TControl`
`);`

## Arguments

`AControl` |  | Control instance which is being freed.

## Description

ControlDestroyed is a method used to update the application when the control in AControl is freed. ControlDestroyed ensures that any property in the application that contains a reference to AControl is set to Nil, including:

- MainForm
- MouseControl
- HintControl
- CreatingForm (internal)

Properties in the Screen singleton are also updated to remove any references to AControl, including:

- ActiveControl
- ActiveCustomForm
- ActiveForm
- FocusedForm

The UpdateLastActive method in Screen is called to perform change notification for the forms and / or controls.

ControlDestroyed is called from the Destroy method in TControl.

## See also

TControl.Destroy |  | Removes the control from its Parent.