DOKK / manpages / debian 10 / libtickit-widgets-perl / Tickit::Widget::CheckButton.3pm.en
Tickit::Widget::CheckButton(3pm) User Contributed Perl Documentation Tickit::Widget::CheckButton(3pm)

"Tickit::Widget::CheckButton" - a widget allowing a toggle true/false option

 use Tickit;
 use Tickit::Widget::CheckButton;
 use Tickit::Widget::VBox;
 my $vbox = Tickit::Widget::VBox->new;
 $vbox->add( Tickit::Widget::CheckButton->new(
       label => "Check button $_",
 ) ) for 1 .. 5;
 Tickit->new( root => $vbox )->run;

This class provides a widget which allows a true/false selection. It displays a clickable indication of status and a caption. Clicking on the status or caption inverts the status of the widget.

This widget is part of an experiment in evolving the design of the Tickit::Style widget integration code, and such is subject to change of details.

The default style pen is used as the widget pen. The following style pen prefixes are also used:

The pen used to render the check marker

The following style keys are used:

The text used to indicate the active status
Number of columns of spacing between the check mark and the caption text

The following style tags are used:

:active
Set when this button's status is true

The following style actions are used:

The main action to activate the "on_click" handler.

Constructs a new "Tickit::Widget::CheckButton" object.

Takes the following named argmuents

The label text to display alongside this button.
Optional. Callback function to invoke when the check state is changed.

$checkbutton->set_label( $label )

Returns or sets the label text of the button.

$checkbutton->set_on_toggle( $on_toggle )

Return or set the CODE reference to be called when the button state is changed.

 $on_toggle->( $checkbutton, $active )

Sets this button's active state to true.

Sets this button's active state to false.

Returns this button's active state.

Paul Evans <leonerd@leonerd.org.uk>

2018-07-30 perl v5.26.2