Class-Functions

LA.Docs
March 1st, 2016

List of Class-Functions


CreateComponentClass(clName: string; owner: TComponent): TComponent

Creates a component from the given string class name. Use this method to dynamically create components in cases where you can’t declare a variable for each class.

CreateControlClass(clName: string; owner: TComponent): TControl

Creates a control from the given string class name. Use this method to dynamically create controls in cases where you can’t declare a variable for each class.

Example Pascal:
var
   component: TComponent;
   control: TControl;
begin
    component := CreateComponentClass(’TTimer’, Sender.Owner);
    ShowMessage(component.ClassName);
 
    component := CreateComponentClass(’TXMLDataset’, Sender.Owner);
    ShowMessage(component.ClassName);
 
    control := CreateControlClass(’TButton’, Sender.Owner);
    ShowMessage(control.ClassName);
 
    control := CreateControlClass(’TLabel’, Sender.Owner);
    ShowMessage(control.ClassName);
end;