Contents Up Previous Next

wxTimer

The wxTimer class allows you to execute code at specified intervals. To use it, derive a new class and override the Notify member to perform the required action. Start with Start, stop with Stop, it's as simple as that.

Derived from

wxObject

Include files

<wx/timer.h>

See also

::wxStartTimer, ::wxGetElapsedTime

Members

wxTimer::wxTimer
wxTimer::~wxTimer
wxTimer::Interval
wxTimer::Notify
wxTimer::Start
wxTimer::Stop


wxTimer::wxTimer

wxTimer()

Constructor.


wxTimer::~wxTimer

~wxTimer()

Destructor. Stops the timer if activated.


wxTimer::Interval

int Interval()

Returns the current interval for the timer.


wxTimer::Notify

void Notify()

This member should be overridden by the user. It is called on timeout.


wxTimer::Start

bool Start(int milliseconds = -1, bool oneShot=FALSE)

(Re)starts the timer. If milliseconds is absent or -1, the previous value is used. Returns FALSE if the timer could not be started, TRUE otherwise (in MS Windows timers are a limited resource).

If oneShot is FALSE (the default), the Notify function will be repeatedly called. If TRUE, Notify will be called only once.


wxTimer::Stop

void Stop()

Stops the timer.