Vcl.Forms.GetParentForm

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function GetParentForm(Control: TControl; TopForm: Boolean = True): TCustomForm;

C++

extern DELPHI_PACKAGE TCustomForm* __fastcall GetParentForm(Vcl::Controls::TControl* Control, bool TopForm = true);

Properties

Type Visibility Source Unit Parent
function public
Vcl.Forms.pas
Vcl.Forms.hpp
Vcl.Forms Vcl.Forms

Description

Returns the form or property page that contains a specified control.

Call GetParentForm to obtain the descendant of TCustomForm that contains the control specified by the Control parameter. If the TopForm parameter if true, this function goes all the way up the parent chain for Control until it finds a Form with no parent. If TopForm if false, this function goes up the parent chain until it finds a Form that is a TCustomForm.

If the control is not contained in a form (for example, an ActiveX control embedded in another type of window), GetParentForm returns nil (Delphi) or NULL (C++).

See Also