RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TProgressBar.Create Constructor

Creates an instance of TProgressBar.

Pascal
constructor Create(AOwner: TComponent); override;
C++
virtual __fastcall TProgressBar(TComponent * AOwner);

Call Create to create a progress bar at runtime. Progress bars placed on forms at design time are created automatically. 

AOwner is another component, typically the form, that is responsible for freeing the progress bar. It becomes the value of the Owner property.  

C++ Examples: 

 

/*
Dynamically create a TProgressBar control and align it to
the bottom of the form.
*/

#include <ComCtrls.hpp>
#include <Controls.hpp>

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  TProgressBar *ProgressBar = new TProgressBar(this);  // The owner will clean this up.
  ProgressBar->Parent = this;
  ProgressBar->Align = alBottom;
  TButton *Button1 = new TButton(this);  // The owner will clean this up.
  Button1->Parent = this;
}

 

Delphi Examples: 

{
Dynamically create a TProgressBar control and align it to
the bottom of the form.
}

var
  I: Integer;

procedure TForm1.Button1Click(Sender: TObject);
var
  ProgressBar: TProgressBar;
begin
  ProgressBar := TProgressBar.Create(Self);
  with ProgressBar do
  begin
    Parent := Self;
    Align := alBottom;
  end;
end;

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!