RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TAnimate.Create Constructor

Creates and initializes an animation control.

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

Call Create to instantiate an animation control at runtime. Animation controls placed on forms at design time are created automatically. 

AOwner is the component that is responsible for freeing the TAnimate instance. It becomes the value of the Owner property.  

C++ Examples: 

 

/*
To run this example, create a new project, place a button on
the form, and insert the example code to the button click
event. Place the button on the bottom of the form to leave
room for the TAnimate component that will be created on the
fly.
*/

#include <memory>       //for STL auto_ptr class

void __fastcall TForm1::Button1Click(TObject *Sender)
{
//  TForm *TempForm = new TForm(this); // The owner (TempForm) would clean this up.
                                     // But we want the form to go away when the proc exits.
  std::auto_ptr<TForm> TempForm(new TForm(this));
  TAnimate *pAnimate = new TAnimate(TempForm.get());   // The owner (TempForm) will clean this up.
  pAnimate->Parent = TempForm.get();
  pAnimate->CommonAVI = aviFindFile;
  pAnimate->Active = true;
  TempForm->Show();
  // Simulate a lengthy process.  Alter this value
  // to accommodate your machine speed.
  for (int i = 0; i < 90000000; i++)
    Application->ProcessMessages();
}

 

Delphi Examples: 

{
To run this example, create a new project, place a button on
the form, and insert the example code to the button click
event. Place the button on the bottom of the form to leave
room for the TAnimate component that will be created on the
fly.
}
procedure TForm1.Button1Click(Sender: TObject);
var
  TempForm: TForm;
  I: Integer;
begin
  TempForm := TForm.Create(Self);
  with TAnimate.Create(TempForm) do
  try
    Parent := TempForm;
    CommonAVI := aviFindFile;
    Active := True;
    TempForm.Show;
    // Simulate a lengthy process.  Alter this value
    // to accommodate your machine speed.
    for I := 0 to 90000000 do Application.ProcessMessages;
  finally
    TempForm.Release;
  end;
end;

 

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