Tk::Action - action abstraction for tk


Tk-Action documentation  | view source Contained in the Tk-Action distribution.

Index


NAME

Top

Tk::Action - action abstraction for tk

VERSION

Top

version 1.093390

SYNOPSIS

Top

    my $action = Tk::Action->new(
        window   => $mw,
        callback => \&jfdi,
    );
    $action->add_widget( $menu_entry );
    $action->add_widget( $button );
    $action->add_binding( '<Control-F>' );
    $action->enable;
    ...
    $action->disable;

DESCRIPTION

Top

Menu entries are often also available in toolbars or other widgets. And sometimes, we want to enable or disable a given action, and this means having to update everywhere this action is allowed.

This module helps managing actions in a Tk GUI: just create a new object, associate some widgets and bindings with add_widget() and then de/activate the whole action at once with enable() or disable().

ATTRIBUTES

Top

callback

The callback associated to the action. It is needed to create the shortcut bindings. Required, no default.

window

The window holding the widgets being part of the action object. It is needed to create the shortcut bindings. Required, no default.

METHODS

Top

$action->add_widget( $widget );

Associate $widget with $action. Enable or disable it depending on current action status.

$action->rm_widget( $widget );

De-associate $widget from C$<action>.

$action->add_binding( $binding );

Associate $binding with $action. Enable or disable it depending on current action status. $binding is a regular binding, as defined by Tk::bind.

It is not possible to remove a binding from an action.

$action->enable;

Activate all associated widgets and shortcuts.

$action->disable;

De-activate all associated widgets and shortcuts.

SEE ALSO

Top

You can look for information on this module at:

* Search CPAN

http://search.cpan.org/dist/Tk-Action

* See open / report bugs

http://rt.cpan.org/NoAuth/Bugs.html?Dist=Tk-Action

* Git repository

http://github.com/jquelin/tk-action

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/Tk-Action

* CPAN Ratings

http://cpanratings.perl.org/d/Tk-Action

AUTHOR

Top

  Jerome Quelin

COPYRIGHT AND LICENSE

Top


Tk-Action documentation  | view source Contained in the Tk-Action distribution.