RAD Studio VCL Reference
|
Occurs when a specified amount of time, determined by the Interval property, has passed.
property OnTimer: TNotifyEvent;
__property TNotifyEvent OnTimer;
Write an OnTimer event handler to execute an action at regular intervals.
The Interval property of a timer determines how frequently the OnTimer event occurs. Each time the specified interval passes, the OnTimer event occurs.
C++ Examples:
/* 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: */ void __fastcall TForm1::Timer1Timer(TObject *Sender) { Timer1->Interval = 100; if (ActiveControl) ActiveControl->Left = ActiveControl->Left + 1; }
Delphi Examples:
{ 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;
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|