[Overview][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'MUIClass.Base' (#MUIClass)

TMUITimer

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

A simple Timer object

Declaration

Source position: MUIClass.Base.pas line 281

type TMUITimer = class end;

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

Inheritance

TMUITimer

  

A simple Timer object

|

TObject

Description

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: TObject);
begin
  writeln('Timer triggered');
end;

// Create a new Timer if needed
procedure TMyWindow.ButtonClick(Sender: TObject);
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;

Documentation generated on: 2019-01-19