App::SysVRcConf::Multistate(3perl) | App::SysVRcConf::Multistate(3perl) |
NAME¶
App::SysVRcConf::UI::Multistate - Create and manipulate multistate widgets
VERSION¶
Version 0.1
CLASS HIERARCHY¶
Curses::UI::Widget | +----Curses::UI::Container | +----App::SysVRcConf::Multistate
SYNOPSIS¶
use Curses::UI; my $cui = new Curses::UI; my $win = $cui->add('window_id', 'Window'); my $tristate = $win->add( 'mytristate', 'App::SysVRcConf::Multistate', -label => 'Tristate question', -states => 'n', 'y', 'm', ); $tristate->focus(); my $definite = $tristate->get_state() eq 'y';
DESCRIPTION¶
App::SysVRcConf::Multistate provides a multistate widget.
This module is an implementation detail of the sysv-rc-conf application.
A multistate box is a control for a multistate value. It consists of a box which can be in one of multiple states. Following this is a text label which described the value being controlled.
[x] This control is in the 'x' state
STANDARD OPTIONS¶
-x -y -width -height -pad -padleft -padright -padtop -padbottom -ipad -ipadleft -ipadright -ipadtop -ipadbottom -title -titlefullwidth -titlereverse -onfocus -onblur -parent
See Curses::UI::Widget for an explanation of these.
WIDGET-SPECIFIC OPTIONS¶
-label¶
Sets the initial label for the checkbox widget to the passed string or value.
-states¶
Takes an ordered list of states for the multistate control to hold. The default is '0', '1' and '?', forming a tristate control. For most purposes the interface deals in zero-based state indexes, which would be 0, 1 and 2 respectively for the default tristate configuration.
-stateind¶
Index of the initial state (defaulting to 0, the first listed state).
-togglemap¶
A hash defining pairs of states for the toggle operation to override its default behaviour.
-shortcuts¶
A hash defining state indexes to be selected for given keypresses.
-onchange¶
Expects a coderef and sets it as a callback for the widget. When the control's state is changed, the given code will be executed.
STANDARD METHODS¶
layout draw intellidraw focus onFocus onBlur
See Curses::UI::Widget for an explanation of these.
WIDGET-SPECIFIC METHODS¶
get¶
Returns the index of the current state of the control.
set¶
Sets the index of the current state of the control.
get_state¶
Returns the character representation of the current state of the control.
toggle¶
Flip-flops the control to an appropriate "other" state. Follows the togglemap hash if defined, otherwise reverts to the previous setting.
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. Override this if unwanted.
- "<"
- Call the "reverse" method.
- ">"
- Call the "cycle" method.
SEE ALSO¶
Curses::UI, Curses::UI::Widget, Curses::UI::Common Curses::UI::Checkbox
AUTHOR¶
Shawn Boyette "<mdxi@cpan.org>", Andrew Bower "<andrew@bower.uk>"
Andrew Bower wrote the Multistate class basing it on the existing Checkbox class.
COPYRIGHT & LICENSE¶
Copyright 2001-2002 Maurice Makaay; 2003-2006 Marcus Thiesen; 2007 Shawn Boyette; 2025 Andrew Bower.
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.
2025-08-10 | perl v5.40.1 |