unit ActiveControl;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Button1: TButton;
    Button2: TButton;
    Timer1: TTimer;
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

// BeginExample: ActiveControl
// Property: Forms.TCustomForm.ActiveControl
// Event: ExtCtrls.TTimer.OnTimer
// Property: ExtCtrls.TTimer.Interval
// Property: Controls.TControl.Left

// BeginCode
{
Place a TTimer object in the form and enter Timer1Timer in 
the OnTimer event.  Place other controls in the form and 
change the active control at runtime.  The following event 
handler responds to timer events by moving the active control
one pixel to the right every 100 miliseconds:
} 
procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Timer1.Interval := 100;
  if ActiveControl <> nil then
    ActiveControl.Left := ActiveControl.Left + 1;
end; 
// EndCode
// EndExample: ActiveControl
end.
