RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TComponent.GetParentComponent Method

Returns the containing Component.

Pascal
function GetParentComponent: TComponent; dynamic;
C++
__fastcall TComponent * GetParentComponent();

GetParentComponent returns a reference to the component that contains the current component, or nil of there is no container. Use HasParent to determine if a component has a containing component.  

For example, a button on a panel on a form returns the panel. The panel returns the form. And the form returns nil. 

 

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