[Properties (by Name)] [Methods (by Name)] [Events (by Name)]
A simple Timer object
Source position: MUIClass.Base.pas line 335
type TMUITimer = class |
||
public |
||
constructor Create; virtual; |
|
Create a new Timer object |
destructor Destroy; override; |
|
Destroy this Timer Object |
published |
||
property Enabled: Boolean; [rw] |
|
Enable/Disable the Timer |
property Interval: Integer; [rw] |
|
Interval the Timer should trigger the OnTimer event in Milliseconds |
property OnTimer: TNotifyEvent; [rw] |
|
Event to be called when the Interval is due |
end; |
|
A simple Timer object |
|
| | ||
TObject |
Timers are automatically connected to the MUIApp, therefore you don't need to destroy them. They will be destroyed automatically on program end by the Application object.
Example:
// Timer event procedure TMyWindow.TimerEvent(Sender: Objectp begin writeln('Timer triggered'); end; // Create a new Timer if needed procedure TMyWindow.ButtonClick(Sender: Object begin if not Assigned(Timer) then begin Timer := TMUITimer.Create; Timer.Interval := 1000; // in ms -> 1 second Timer.OnTimer := @TimerEvent; // connect the event end; Timer.Enabled := not Timer.Enabled; // Toggle timer on Button Click end;