DesignIntf.IDesigner60.GetComponent

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function GetComponent(const Name: string): TComponent;

C++

virtual System::Classes::TComponent* __fastcall GetComponent(const System::UnicodeString Name) = 0 ;

Properties

Type Visibility Source Unit Parent
function public
DesignIntf.pas
DesignIntf.hpp
DesignIntf IDesigner60

Description

Returns the component with the name passed as a parameter.

Call GetComponent to access a component given its name. If the component is not in the current root object, the Name parameter should include the name of the entity in which it resides. For example, to obtain a reference to a component in a data module named 'DataModule2', use a line such as



TheComponent := Designer.GetComponent('DataModule2.Button1'); {Delphi}



TheComponent = Designer->GetComponent("DataModule2->Button1"); // C++



If DataModule2's unit is in the uses clause of the current root object (Delphi) or its header is included by the root object's unit (C++), GetComponent returns the component.

Note: To obtain a reference to a persistent object that is not a component, use the GetObject method instead.

See Also