kmx > Win32-GUI-1.12 > Win32::GUI::Timer


Annotate this POD

View/Report Bugs


Win32::GUI::Timer - Create and manipulate periodic Timer events


The Timer object is a special kind of control: it has no appearance, its only purpose is to trigger an event every specified amount of time. You can create a Timer object in either of these ways:

  new Win32::GUI::Timer( PARENT, NAME, ELAPSE )

where NAME is the name for the Timer object (used to lookup the associated event). and ELAPSE is the number of milliseconds after which the Timer() event will be periodically triggered.

Once you've created the Timer object, you can change the ELAPSE parameter with the Interval() method, or disable the Timer with the Kill() method.

The triggered OEM event is called as "$name_Timer"() The triggered NEM event is defined as -onTimer => sub{} method of the parent window.


Common methods apply to most windows, controls and resources.



Creates a new timer in the PARENT window named NAME that will trigger its Timer() event after ELAPSE milliseconds. Can also be called as PARENT->AddTimer(NAME, ELAPSE).

If NAME is not supplied, then an internal name will be allocated.

ELAPSE must by an integer greater than or equal to zero. If ELAPSE is 0, then the timer object is created, but the timer will be disabled. You can then start the timer by calling the Interval() method and setting ELAPSE to a non-zero number. If ELASPE is not supplied, then 0 will be used.

Note: Different OS versions might change too low or large intervals for ELAPSE to more appropriate values. E.g. > 0x7fffffff or < 10

See also the common options.



Get or set the periodic timer interval. Unit: ms When setting a new interval, any existing timer is reset. When setting returns the previous interval.

Setting ELAPSE to 0 suspends the timer (i.e. it will not fire timer events). The timer can be restarted later by setting ELAPSE to a positive value.

Note: Different OS versions might change too low or large intervals for ELAPSE to more appropriate values. E.g. > 0x7fffffff or < 10



Remove the periodic timer event.

Kill() with no parameters, or a False parameter suspends the timer, exactly as $timer->Interval(0); In this case it return the previous interval.

Kill() with a True parameter will stop and remove all traces of the timer. To use system resources efficiently, applications should Kill(1) timers that are no longer necessary.


Common events apply to most windows and controls.


Documentation for Win32::GUI v1.12 created 03 Jun 2015

This document is autogenerated by the build process. Edits made here will be lost. Edit docs/per_package.tpl instead.



For further support join the users mailing list from the website at There is a searchable list archive at


Copyright (c) 1997..2015 Aldo Calpini. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: