1Curses::UI::Checkbox(3)User Contributed Perl DocumentatioCnurses::UI::Checkbox(3)
2
3
4

NAME

6       Curses::UI::Checkbox - Create and manipulate checkbox widgets
7

VERSION

9       Version 1.11
10

CLASS HIERARCHY

12        Curses::UI::Widget
13           |
14           +----Curses::UI::Container
15                   |
16                   +----Curses::UI::Checkbox
17

SYNOPSIS

19           use Curses::UI;
20           my $cui = new Curses::UI;
21           my $win = $cui->add('window_id', 'Window');
22
23           my $checkbox = $win->add(
24               'mycheckbox', 'Checkbox',
25               -label     => 'Say hello to the world',
26               -checked   => 1,
27           );
28
29           $checkbox->focus();
30           my $checked = $checkbox->get();
31

DESCRIPTION

33       Curses::UI::Checkbox provides a checkbox widget.
34
35       A checkbox is a control for a boolean value (an on/off toggle). It
36       consists of a box which will either be empty (indicating off or false)
37       or contain an "X" (indicating on or true). Following this is a text
38       label which described the value being controlled.
39
40           [X] This checkbox is on/true/checked/selected
41           [ ] This checkbox is off/false/unchecked/deselected
42
43       See exampes/demo-Curses::UI::Checkbox in the distribution for a short
44       demo.
45

STANDARD OPTIONS

47           -x  -y   -width    -height
48           -pad     -padleft  -padright  -padtop  -padbottom
49           -ipad    -ipadleft -ipadright -ipadtop -ipadbottom
50           -title   -titlefullwidth      -titlereverse
51           -onfocus -onblur
52           -parent
53
54       See Curses::UI::Widget for an explanation of these.
55

WIDGET-SPECIFIC OPTIONS

57   -label
58       Sets the initial label for the checkbox widget to the passed string or
59       value.
60
61   -checked
62       Takes a boolean argument. Determines if the widget's initial state is
63       checked or unchecked.  The default is false (unchecked).
64
65   -onchange
66       Expects a coderef and sets it as a callback for the widget. When the
67       checkbox's state is changed, the given code will be executed.
68

STANDARD METHODS

70           layout draw    intellidraw
71           focus  onFocus onBlur
72
73       See Curses::UI::Widget for an explanation of these.
74

WIDGET-SPECIFIC METHODS

76   get
77       Returns the current state of the checkbox (0 == unchecked, 1 ==
78       checked).
79
80   check
81       Sets the checkbox to "checked".
82
83   uncheck
84       Sets the checkbox to "unchecked".
85
86   toggle
87       Flip-flops the checkbox to its "other" state. If the checkbox is
88       unchecked then it will become checked, and vice versa.
89
90   onChange
91       This method can be used to set the "-onchange" event handler (see
92       above) after initialization of the checkbox. It expects a coderef as
93       its argument.
94

DEFAULT BINDINGS

96       "[TAB]", "[ENTER}"
97           Call the 'loose-focus' routine, causing the widget to lose focus.
98
99       "[SPACE]"
100           Call the "toggle" method.
101
102       0, "n"
103           Call the "uncheck" method.
104
105       1, "y"
106           Call the "check" method.
107

SEE ALSO

109       Curses::UI, Curses::UI::Widget, Curses::UI::Common
110

AUTHOR

112       Shawn Boyette "<mdxi@cpan.org>"
113
115       Copyright 2001-2002 Maurice Makaay; 2003-2006 Marcus Thiesen; 2007
116       Shawn Boyette. All Rights Reserved.
117
118       This program is free software; you can redistribute it and/or modify it
119       under the same terms as Perl itself.
120
121       This package is free software and is provided "as is" without express
122       or implied warranty. It may be used, redistributed and/or modified
123       under the same terms as perl itself.
124
125
126
127perl v5.34.0                      2022-01-21           Curses::UI::Checkbox(3)
Impressum