Padre::Wx::Role::Dwell - Convenience methods for implementing dwell timers


Padre documentation  | view source Contained in the Padre distribution.

Index


NAME

Top

Padre::Wx::Role::Dwell - Convenience methods for implementing dwell timers

DESCRIPTION

Top

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

Top

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

Top


Padre documentation  | view source Contained in the Padre distribution.