[archived content]

About

A Timer calls tick event handlers every interval milliseconds after start() and before stop().

Example

class Foo
{
        // Call to start the timer.
        void startTimer()
        {
                Timer t = new Timer();
                t.interval = 2000; // Every 2 seconds.
                t.tick ~= &myTicked; // Add event handler.
                t.start(); // Start timer!
        }

        // Event handler method used above..
        // Note that it keeps being called every 2 seconds once started.
        private void myTicked(Timer sender, EventArgs ea)
        {
                // timeout action
                //sender.stop();
        }
}

module dfl.timer;
public class Timer
{
protected void dispose();
public bool enabled; [property setter]
public bool enabled; [property getter]
public final size_t interval; [property setter]
public final size_t interval; [property getter]
protected void onTick(EventArgs ea);
public final void start();
public final void stop();
public Event tick(Timer,EventArgs);
}

Page last modified on July 03, 2008, at 07:51 PM