Vcl.Controls.TWinControl.SetParent

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure SetParent(AParent: TWinControl); override;

C++

virtual void __fastcall SetParent(TWinControl* AParent);

Properties

Type Visibility Source Unit Parent
procedure
function
protected
Vcl.Controls.pas
Vcl.Controls.hpp
Vcl.Controls TWinControl

Description

Sets the parent of the control.

Vcl.Controls.TWinControl.SetParent inherits from Vcl.Controls.TControl.SetParent. All content below this line refers to Vcl.Controls.TControl.SetParent.

Sets the parent of the control.

SetParent is the protected implementation of the Parent property. Override SetParent to execute additional code when the value of the Parent property changes.

The AParent parameter specifies the new parent of the control.

If the control already has a parent, SetParent removes the control from that parent's list of controls by calling the parent's RemoveControl method. If AParent is not nil (Delphi) or NULL (C++), SetParent calls its InsertControl method to add the control to its list of controls.

The TControl destructor calls SetParent(nil (Delphi) or NULL (C++)) to remove the control from its parent's control list before destroying the component.

See Also