OnAnimate Event example for Delphi

This example shows how the OnAnimate event can be used to toggle the use of a button to start and stop the animation.

procedure TForm1.Lead1Animate(Sender: TObject; bEnable: Wordbool);
begin
  if bEnable = True then
    Button1.Caption := 'Stop Animation'
  else
    Button1.Caption := 'Start Animation'
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  if Lead1.AnimationEnable = True Then
    Lead1.AnimationEnable := False
  else
    Lead1.AnimationEnable := True ;
end;