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

GetParentForm

Gets the form instance for the specified Control.

Declaration

Source position: forms.pp line 1968

function GetParentForm(

  Control: TControl;

  TopForm: Boolean = True

):TCustomForm;

Arguments

Control

  

Control used to locate the parent form in the control hierarchy.

TopForm

  

True if the top-most form instance in the control hierarchy is needed.

Function result

Form instance that is the parent for the specified control.

Description

GetParentForm is a TCustomForm function used to the form instance for the control specified in the Control argument.

Control is the TControl instance examined in the method. The Parent property is used to navigate to preceding parent controls until a TCustomForm instance is found.

TopForm indicates if the top-most form instance in the hierarchy is needed. When set to False, the first TCustomForm instance found in the control hierarchy is used. Otherwise, all Parent controls in the hierarchy are examined until a Parent control has not been assigned.

The return value can contain the value in Control if it is a TCustomForm descendant and no other form instances are used in the control hierarchy. This is Delphi compatible.


Version 3.2 Generated 2024-02-25 Home