The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

IUP::Timer - [special] periodicaly invokes a callback when the time is up

DESCRIPTION

Creates a timer which periodicaly invokes a callback when the time is up. Each timer should be destroyed using Destroy (or simply by undef $timer).

USAGE

CREATION - new() method

 $timer = IUP::Timer->new();

Returns: the identifier of the created element, or undef if an error occurs.

NOTE: You can pass to new() other ATTRIBUTE=>'value' or CALLBACKNAME=>\&func pairs relevant to this element - see IUP::Manual::02_Elements.

ATTRIBUTES

For more info about concept of attributes (setting/getting values etc.) see IUP::Manual::03_Attributes. Attributes specific to this element:

TIME

The time interval in milliseconds. In Windows the minimum value is 10ms.

RUN

Starts and stops the timer. Possible values: "YES" or "NO". Returns the current timer state. If you have multiple threads start the timer in the main thread.

WID

(read-only) Returns the native serial number of the timer. Returns -1 if not running. A timer is mapped only when it is running.

CALLBACKS

For more info about concept of callbacks (setting callback handlers etc.) see IUP::Manual::04_Callbacks. Callbacks specific to this element:

ACTION_CB

Called when the time is up.

Callback handler prototype:

 sub action_cb_handler {
   my ($self) = @_;
   #...
 }

    $self: reference to the element (IUP::Timer) that activated the event

    Returns: IUP_CLOSE will be processed.

EXAMPLES

The element IUP::Timer is used in the following sample scripts:

SEE ALSO

The original doc: iuptimer.html