Curses:...heckbox(3)
π NAME π
Curses::UI::Checkbox - Create and manipulate checkbox widgets.
Hiii bestie! This is the manual page for Curses:...heckbox(3) from the User Contributed Perl Documentation β aka the docs for Curses::UI::Checkbox. We're about to make a checkbox widget together, and yes, it's gonna be iconic. π
π VERSION π
Version 1.11 β that's the version, bestie. Slay.
π¦ CLASS HIERARCHY π¦
The family tree is giving inheritance realness, no cap:
Curses::UI::Widget
|
+----Curses::UI::Container
|
+----Curses::UI::Checkbox
β¨ SYNOPSIS β¨
Here's the whole vibe in code. Copy it exactly and you're golden:
use Curses::UI;
my $cui = new Curses::UI;
my $win = $cui->add('window_id', 'Window');
my $checkbox = $win->add(
'mycheckbox', 'Checkbox',
-label => 'Say hello to the world',
-checked => 1,
);
$checkbox->focus();
my $checked = $checkbox->get();
π DESCRIPTION π
Curses::UI::Checkbox provides a checkbox widget. Lowkey simple, highkey useful.
A checkbox is a control for a boolean value (an on/off toggle). It consists of a box which will either be empty (indicating off or false) or contain an "X" (indicating on or true). Following this is a text label which described the value being controlled. Like this:
[X] This checkbox is on/true/checked/selected
[ ] This checkbox is off/false/unchecked/deselected
See exampes/demo-Curses::UI::Checkbox in the distribution for a short demo. Yes, exampes is exactly how it's spelled there β we keep the details, bestie. π
π STANDARD OPTIONS π
All of these are standard options, and Curses::UI::Widget explains them:
-xβ standard option, explained inCurses::UI::Widget.-yβ standard option, explained inCurses::UI::Widget.-widthβ standard option, explained inCurses::UI::Widget.-heightβ standard option, explained inCurses::UI::Widget.-padβ standard option, explained inCurses::UI::Widget.-padleftβ standard option, explained inCurses::UI::Widget.-padrightβ standard option, explained inCurses::UI::Widget.-padtopβ standard option, explained inCurses::UI::Widget.-padbottomβ standard option, explained inCurses::UI::Widget.-ipadβ standard option, explained inCurses::UI::Widget.-ipadleftβ standard option, explained inCurses::UI::Widget.-ipadrightβ standard option, explained inCurses::UI::Widget.-ipadtopβ standard option, explained inCurses::UI::Widget.-ipadbottomβ standard option, explained inCurses::UI::Widget.-titleβ standard option, explained inCurses::UI::Widget.-titlefullwidthβ standard option, explained inCurses::UI::Widget.-titlereverseβ standard option, explained inCurses::UI::Widget.-onfocusβ standard option, explained inCurses::UI::Widget.-onblurβ standard option, explained inCurses::UI::Widget.-parentβ standard option, explained inCurses::UI::Widget.
πΈ WIDGET-SPECIFIC OPTIONS πΈ
π -label π
Sets the initial label for the checkbox widget to the passed string or value. So you can put whatever cute little text you want next to the box.
π -checked π
Takes a boolean argument. Determines if the widget's initial state is checked or unchecked. The default is false (unchecked).
π -onchange π
Expects a coderef and sets it as a callback for the widget. When the checkbox's state is changed, the given code will be executed. Callback era, periodt.
π₯ STANDARD METHODS π₯
layout draw intellidraw
focus onFocus onBlur
See Curses::UI::Widget for an explanation of these.
π WIDGET-SPECIFIC METHODS π
get
Returns the current state of the checkbox (0 == unchecked, 1 == checked).
check
Sets the checkbox to "checked".
uncheck
Sets the checkbox to "unchecked".
toggle
Flip-flops the checkbox to its "other" state. If the checkbox is unchecked then it will become checked, and vice versa. It's giving switch energy. π₯
onChange
This method can be used to set the "-onchange" event handler (see above) after initialization of the checkbox. It expects a coderef as its argument.
π DEFAULT BINDINGS π
"[TAB]", "[ENTER}"β Call the'loose-focus'routine, causing the widget to lose focus."[SPACE]"β Call thetogglemethod.0, "n"β Call theuncheckmethod.1, "y"β Call thecheckmethod.
π«Ά SEE ALSO π«Ά
Curses::UI, Curses::UI::Widget, Curses::UI::Common
β AUTHOR β
Shawn Boyette "<mdxi@cpan.org>"
π§ COPYRIGHT & LICENSE π§
Copyright 2001-2002 Maurice Makaay; 2003-2006 Marcus Thiesen; 2007 Shawn Boyette. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
This package is free software and is provided "as is" without express or implied warranty. It may be used, redistributed and/or modified under the same terms as perl itself.
Okay bestie, that's the whole page π Footer tea: perl v5.42.2, dated 2023-07-03, and the manual name is Curses:...heckbox(3). Go slay those checkboxes, periodt. π
β¨
π¦ where this page comes from
- alpine 3.24: perl-curses-ui-doc 0.9609-r3 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms