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 in Curses::UI::Widget.
  • -y β€” standard option, explained in Curses::UI::Widget.
  • -width β€” standard option, explained in Curses::UI::Widget.
  • -height β€” standard option, explained in Curses::UI::Widget.
  • -pad β€” standard option, explained in Curses::UI::Widget.
  • -padleft β€” standard option, explained in Curses::UI::Widget.
  • -padright β€” standard option, explained in Curses::UI::Widget.
  • -padtop β€” standard option, explained in Curses::UI::Widget.
  • -padbottom β€” standard option, explained in Curses::UI::Widget.
  • -ipad β€” standard option, explained in Curses::UI::Widget.
  • -ipadleft β€” standard option, explained in Curses::UI::Widget.
  • -ipadright β€” standard option, explained in Curses::UI::Widget.
  • -ipadtop β€” standard option, explained in Curses::UI::Widget.
  • -ipadbottom β€” standard option, explained in Curses::UI::Widget.
  • -title β€” standard option, explained in Curses::UI::Widget.
  • -titlefullwidth β€” standard option, explained in Curses::UI::Widget.
  • -titlereverse β€” standard option, explained in Curses::UI::Widget.
  • -onfocus β€” standard option, explained in Curses::UI::Widget.
  • -onblur β€” standard option, explained in Curses::UI::Widget.
  • -parent β€” standard option, explained in Curses::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 the toggle method.
  • 0, "n" β€” Call the uncheck method.
  • 1, "y" β€” Call the check method.

🫢 SEE ALSO 🫢

Curses::UI, Curses::UI::Widget, Curses::UI::Common

⭐ AUTHOR ⭐

Shawn Boyette "<mdxi@cpan.org>"

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