Unit 'Controls' Package
[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] [#lcl]


Finds the control that is the top-most Parent in the control hierarchy.


Source position: controls.pp line 1684

public function TControl.GetTopParent: TControl;

Function result

TControl instance which is the top-most Parent in the control hierarchy, or Self.


GetTopParent is a TControl function used to get the control which is the top-most or initial Parent in the control hierarchy.

GetTopParent visits each of the control instances in the Parent property. The return value is set to control where Parent is unassigned (Nil). The return value is the current control instance (Self) if Parent has not been assigned.

GetTopParent is used in methods like ChangeBounds where the parent handles layout or sizing for its child controls. The method is also used in descendent classes, like TWinControl, when messages are handled which resized, move, or otherwise reposition the windowed control.

CT Web help

CodeTyphon Studio