Tickit::Widget::Button - a widget displaying a clickable button
Tickit::Widget::Button
use Tickit; use Tickit::Widget::Button; my $button = Tickit::Widget::Button->new( label => "Click Me!", on_click => sub { my ( $self ) = @_; # Do something! }, ); Tickit->new( root => $button )->run;
This class provides a widget which displays a clickable area with a label. When the area is clicked, a callback is invoked.
The default style pen is used as the widget pen. The following style keys are used:
What kind of border to draw around the button; one of
none single double thick
A two-character string to place just before the button label
A two-character string to place just after the button label
The following style tags are used:
Set when the mouse is being held over the button, before it is released
The following style actions are used:
The main action to activate the on_click handler.
on_click
Constructs a new Tickit::Widget::Button object.
Takes the following named arguments:
Text to display in the button area
Optional. Callback function to invoke when the button is clicked.
Return or set the text to display in the button area.
Return or set the CODE reference to be called when the button area is clicked.
$on_click->( $button )
Behave as if the button has been clicked; running its on_click handler. This is provided for convenience of activating its handler programatically via other parts of code.
Accessors for the horizontal and vertical alignment of the label text within the button area. See also Tickit::WidgetRole::Alignable.
Paul Evans <leonerd@leonerd.org.uk>
To install Tickit::Widgets, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tickit::Widgets
CPAN shell
perl -MCPAN -e shell install Tickit::Widgets
For more information on module installation, please visit the detailed CPAN module installation guide.