ActiveControl (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

Place a TTimer object on the form and enter Timer1Timer in the OnTimer event. Place other controls on the form and change the active control at run time. The following event handler responds to timer events by moving the active control one pixel to the right every 100 milliseconds.

Code

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Timer1.Interval := 100;
  if ActiveControl <> nil then
    ActiveControl.Left := ActiveControl.Left + 1;
end;

Uses