Mega Code Archive

 
Categories / Delphi / Examples
 

Find a component by name

Title: Find a component by name Question: How to prevent direct references to controls or objects ? Answer: RTTI (Runtime Type Information) is a strengh of Delphi. Use it wherever you can. Look how to find a component by name: var MyComp: TComponent; begin MyComp := FindComponent("Name"); If MyComp is TPanel then TPanel(MyComp).Color := clBlue; end;