-
-
20 Nov 2021 15:13:20 UTC
- Distribution: Tickit-Widgets
- Module version: 0.34
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (12)
- Testers (80 / 1 / 38)
- Kwalitee
Bus factor: 1- % Coverage
- License: perl_5
- Perl: v5.20.0
- Activity
24 month- Tools
- Download (89.07KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
NAME
Tickit::Widget::Button
- a widget displaying a clickable buttonSYNOPSIS
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;
DESCRIPTION
This class provides a widget which displays a clickable area with a label. When the area is clicked, a callback is invoked.
STYLE
The default style pen is used as the widget pen. The following style keys are used:
- linetype => STRING
-
What kind of border to draw around the button; one of
none single double thick
- marker_left => STRING
-
A two-character string to place just before the button label
- marker_right => STRING
-
A two-character string to place just after the button label
The following style tags are used:
The following style actions are used:
- click
-
The main action to activate the
on_click
handler.
CONSTRUCTOR
new
$button = Tickit::Widget::Button->new( %args )
Constructs a new
Tickit::Widget::Button
object.Takes the following named arguments:
- label => STR
-
Text to display in the button area
- on_click => CODE
-
Optional. Callback function to invoke when the button is clicked.
ACCESSORS
label
$label = $button->label
set_label
$button->set_label( $label )
Return or set the text to display in the button area.
on_click
$on_click = $button->on_click
set_on_click
$button->set_on_click( $on_click )
Return or set the CODE reference to be called when the button area is clicked.
$on_click->( $button )
click
$button->click
Behave as if the button has been clicked; running its
on_click
handler. This is provided for convenience of activating its handler programmatically via other parts of code.align
set_align
valign
set_valign
$align = $button->align $button->set_align( $align ) $valign = $button->valign $button->set_valign( $valign )
Accessors for the horizontal and vertical alignment of the label text within the button area. See also Tickit::WidgetRole::Alignable.
AUTHOR
Paul Evans <leonerd@leonerd.org.uk>
Module Install Instructions
To install Tickit::Widgets, copy and paste the appropriate command in to your terminal.
cpanm Tickit::Widgets
perl -MCPAN -e shell install Tickit::Widgets
For more information on module installation, please visit the detailed CPAN module installation guide.