Tickit...kButton(3pm)
π Tickit::Widget::CheckButton β the manual, bestie edition π
okay so this is Tickit::Widget::CheckButton, a lil Perl module from the user-contributed Perl docs. it's a widget. it does a toggle. it's giving "yes/no but make it β¨aestheticβ¨". let's get into it π
β¨ NAME β¨
Tickit::Widget::CheckButton β a widget allowing a toggle true/false option π
like... it's a checkbox. a button. a check button. the vibes are immaculate and the answer is either yes or no, no in-between, periodt.
πΈ SYNOPSIS πΈ
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;
not me making five check buttons in a for loop like it's nothing π iconic behaviour honestly. 1 .. 5, five buttons, one vbox, and then you just run it. slay.
π¦ DESCRIPTION π¦
so this class gives you a widget that lets you pick true or false. that's it. that's the whole job. it shows you a clickable little indication of the status plus a caption, and when you click on either the status or the caption, the status flips. invert. toggle. uno reverse card π
lowkey important: this widget is part of an experiment in evolving the design of the Tickit::Style widget integration code, so the details are subject to change. don't get too attached to specifics, bestie π
π STYLE π
the default style pen is used as the widget pen. and then there's more. the following style pen prefixes are also used:
check => PENβ the pen used to render the check marker β
the following style keys are used:
check => STRINGβ the text used to indicate the active statusspacing => INTβ 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:
toggleβ the main action to activate theon_clickhandler
so yeah. pens, keys, tags, actions. the full aesthetic toolkit π§
π CONSTRUCTOR π
new
$checkbutton = Tickit::Widget::CheckButton->new( %args );
constructs a new Tickit::Widget::CheckButton object. fresh out the box, main character energy π
takes the following named argmuents:
label => STRINGβ the label text to display alongside this button.on_toggle => CODEβ optional. callback function to invoke when the check state is changed.
(yes the original says "argmuents". we keep the typo. it's part of the lore now π)
π ACCESSORS π
label
set_label
$label = $checkbutton->label;
$checkbutton->set_label( $label );
returns or sets the label text of the button. get it, set it, live your truth β¨
on_toggle
$on_toggle = $checkbutton->on_toggle;
set_on_toggle
$checkbutton->set_on_toggle( $on_toggle );
return or set the CODE reference to be called when the button state is changed. and here's how it gets called:
$on_toggle->( $checkbutton, $active );
it hands you the button and the active state. two for one. obsessed π«Ά
π₯ METHODS π₯
activate
$checkbutton->activate;
sets this button's active state to true. no cap.
deactivate
$checkbutton->deactivate;
sets this button's active state to false. rip.
is_active
$active = $checkbutton->is_active;
returns this button's active state. the vibe check, basically π
π AUTHOR π
Paul Evans <leonerd@leonerd.org.uk> β the legend themselves π
and that's the whole page, bestie! this one shipped as perl v5.40.0, dated 2024-09-16, from the Tickit...kButton(3pm) corner of the User Contributed Perl Documentation. go forth and toggle something, you absolute icon π
πβ¨
π¦ where this page comes from
- ubuntu resolute: libtickit-widgets-perl 0.42-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtickit-widgets-perl 0.42-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms