TControlClass defines the metaclass for TControl.
TControlClass = class of TControl;
TControl * TControlClass;
TControlClass is the metaclass for TControl. Its value is the class reference for TControl or for one of its descendants.
Delphi Examples:
{ To run this example, add the example code to a new project. The example code dynamically creates a TCoolBar and three TCoolBand objects populated with a windowed control in each TCoolBand. } procedure AddBand(CoolBar: TCoolBar; Const ControlClasses: array of TControlClass); var CurrentControl: TControl; I: Integer; begin for I := 0 to High(ControlClasses) do begin CurrentControl := ControlClasses[i].Create(CoolBar); if (CurrentControl is TWinControl) then begin { Placing the control onto the CoolBar causes the TCoolBar object to create a TCoolBand and place the control within the band. } CurrentControl.Parent := Coolbar; { Get the reference of the last TCoolBand created and assign text. } with CoolBar.Bands do Items[count - 1].Text := CurrentControl.ClassName; end; end; end; procedure TForm1.FormCreate(Sender: TObject); var CoolBar: TCoolBar; begin CoolBar := TCoolBar.Create(Self); CoolBar.Parent := Self; CoolBar.Align := alClient; AddBand(CoolBar, [TCheckBox, TEdit, TButton]); end;
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|