NAME
Curses::UI::CheckBox - Create and manipulate checkbox widgets
SYNOPSIS
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 is a widget that can be used to create a checkbox. A checkbox has a label which says what the checkbox is about and in front of the label there is a box which can have an "X" in it. If the "X" is there, the checkbox is checked (get will return a true value). If the box is empty, the checkbox is not checked (get will return a false value). A checkbox looks like this:
[X] Say hello to the world
See exampes/demo-Curses::UI::CheckBox in the distribution for a short demo.
STANDARD OPTIONS
-parent, -x, -y, -width, -height, -pad, -padleft, -padright, -padtop, -padbottom, -ipad, -ipadleft, -ipadright, -ipadtop, -ipadbottom, -title, -titlefullwidth, -titlereverse
For an explanation of these standard options, see Curses::UI::Widget.
WIDGET-SPECIFIC OPTIONS
-label < TEXT >
This will set the text label for the checkbox widget to TEXT.
-checked < BOOLEAN >
This option determines if at creation time the checkbox should be checked or not. By default this option is set to false, so the checkbox is not checked.
METHODS
new ( OPTIONS )
layout ( )
draw ( BOOLEAN )
focus ( )
These are standard methods. See Curses::UI::Widget for an explanation of these.
get ( )
This method will return the current state of the checkbox (0 = not checked, 1 = checked).
check ( )
This method can be used to set the checkbox to its checked state.
uncheck ( )
This method can be used to set the checkbox to its unchecked state.
toggle ( )
This method will set the checkbox in "the other state". This means that the checkbox will get checked if it is not and vice versa.
DEFAULT BINDINGS
<tab>, <enter>
Call the 'return' routine. This will have the widget loose its focus.
<space>
Call the 'toggle' routine (see the toggle method).
<0>, <n>
Call the 'uncheck' routine (see the uncheck method).
<1>, <y>
Call the 'check' routine (see the check method).
SEE ALSO
Curses::UI, Curses::UI::Widget, Curses::UI::Common
AUTHOR
Copyright (c) 2001-2002 Maurice Makaay. All rights reserved.
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.