RAD Studio VCL Reference
|
Creates and initializes a TCoolBar instance.
constructor Create(AOwner: TComponent); override;
virtual __fastcall TCoolBar(TComponent * AOwner);
Call Create to create a cool bar at runtime. Cool bars added at design time are created automatically.
AOwner is the component that is responsible for freeing the cool bar instance. Typically, this is the form. It becomes the value of the Owner property.
Create generates a TCoolBar object and initializes its properties. If COMCTL32.DLL cannot be found, Create raises the EComponentError exception.
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!
|