Site Navigation

User Guide

Reference

Packages

 

DESCRIPTION

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 )
  PARENT->AddTimer( 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.

METHODS

Common methods apply to most windows, controls and resources.

new

new(PARENT, [NAME, [ELAPSE]])

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.

Interval

Interval(ELAPSE)

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

Kill

Kill([REMOVE=0])

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.

EVENTS

Common events apply to most windows and controls.

VERSION

Documentation for Win32::GUI v1.06 created 13 Feb 2008

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

SUPPORT

Homepage: http://perl-win32-gui.sourceforge.net/.

For further support join the users mailing list(perl-win32-gui-users@lists.sourceforge.net) from the website at http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users. There is a searchable list archive at http://sourceforge.net/mail/.

COPYRIGHT and LICENCE

Copyright (c) 1997..2008 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.