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

# TWinControl.Destroy

Destructor for the class instance.

## Declaration

Source position: controls.pp line 2395

`public destructor TWinControl.Destroy; override;`

## Description

Destroy is the overridden destructor for the class instance.

Destroy call RemoveFocus to ensure that the control cannot receive focus from a Parent control. If a handle has been allocated for the windowed control, the DestroyHandle method is called.

Destroy iterates over Controls to remove the value in the Parent property for each child control, and to remove an assigned HostDockSite. It does not actually free the child Controls; they are freed by the owner of the control instance (usually a TForm instance).

Destroy ensures that any controls in the DockClients property remove the current class instance from their host dock site.

Destroy frees resources allocated in the constructor, or in other class methods, including the DockManager and DockCients. Destroy calls the inherited destructor prior to exiting from the method.

## See also

TControl.Parent |  | The control within which the control is shown.
TWinControl.Controls |  | Provides indexed access to the child controls for the class instance.
TWinControl.RemoveControl |  | Removes the specified control from the Controls property.
TWinControl.DockManager |  | The docking layout manager for this control.
TWinControl.DockClients |  | The indexed list of controls docked into this control.
TControl.HostDockSite |  | The host site (TWinControl) into which this control is docked. Nil if not docked.