NAME

Padre::Wx::Role::Timer - Convenience methods for working with Wx timers

DESCRIPTION

This role implements a set of methods for letting Wx objects in Padre implement dwell events on elements that do not otherwise natively support them.

In this initial simplified implementation, we support only one common dwell event for each combination of object class and dwell method.

If multiple instances of a class are used, then the timer id will collide across multiple timers and unexpected behaviour may occur.

METHODS

dwell_start

# Half second dwell timer on a text input
$wx_object->dwell_start( on_text => 500 );

The dwell_start method starts (or restarts) the dwell timer.

It has two required parameters of the method to call, and the amount of time (in thousands of a second) that the event should be delayed.

Note that when the dwell-delayed event is actually called, it will NOT be passed the original Wx event object. The method will be called directly and with no parameters.

Please note that calling this method will result in the creating of a Wx::Timer object in an object HASH slot that matches the name of the method.

As a result, if you wish to create a dwell to a method "foo" you may never make use of the $wx_object->{foo} slot on that object.

dwell_stop

$wx_object->dwell_stop( 'on_text' );

The dwell_stop method prevents a single named dwell event from firing, if there is a timer underway.

If there is no dwell for the named event the method will silently succeed.

COPYRIGHT & LICENSE

Copyright 2008-2012 The Padre development team as listed in Padre.pm.

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

The full text of the license can be found in the LICENSE file included with this module.