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

# TControl.GetTopParent

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

## Declaration

Source position: controls.pp line 1709

`public function TControl.GetTopParent: TControl;`

## Function result

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

## Description

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.