IUP::Timer - [special] periodicaly invokes a callback when the time is up
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).
undef $timer
$timer = IUP::Timer->new();
Returns: the identifier of the created element, or undef if an error occurs.
undef
NOTE: You can pass to new() other ATTRIBUTE=>'value' or CALLBACKNAME=>\&func pairs relevant to this element - see IUP::Manual::02_Elements.
new()
ATTRIBUTE=>'value'
CALLBACKNAME=>\&func
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.
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.
The element IUP::Timer is used in the following sample scripts:
0-basic/glcanvas2.pl - IUP::CanvasGL example
0-basic/progressbar2.pl - IUP::ProgressBar example
0-basic/timer.pl - IUP::Timer example
The original doc: iuptimer.html
To install IUP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm IUP
CPAN shell
perl -MCPAN -e shell install IUP
For more information on module installation, please visit the detailed CPAN module installation guide.