RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
Forms.GetParentForm Function

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

Pascal
function GetParentForm(Control: TControl; TopForm: Boolean = True): TCustomForm;
C++
TCustomForm GetParentForm(TControl * Control, Boolean TopForm = True);

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++). 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!