NAME
Curses::UI::Buttons - Create and manipulate button widgets
SYNOPSIS
use Curses::UI;
my $cui = new Curses::UI;
my $win = $cui->add('window_id', 'Window');
$win->add(
'mybuttons', 'Buttons',
-x => 1,
-y => 1,
-buttons => ['< Button 1 >', '< Button 2>']
-values => [1,2]
-shortcuts => ['1','2'],
);
DESCRIPTION
Curses::UI::Buttons is a widget that can be used to create an array of buttons.
STANDARD OPTIONS
-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
-
This option takes a reference to a list of buttonlabels as its argument.
- -values <arrayref>
-
This option takes a reference to a list of values as its argument. The order of the values in the list corresponds to the order of the buttons.
- -shortcuts <arrayref>
-
This option takes a reference to a list of shortcut keys as its argument. The order of the keys in the list corresponds to the order of the buttons.
-
By default the first button (index = 0) is active. If you want another button to be active at creation time, add this option. The value is the index of the button you want to make active.
-
You can specify how the buttons should be aligned in the widget. Available values for this option are 'left', 'middle' and 'right'.
- -mayloosefocus <0 or 1>
-
By default a buttons widget may loose it's focus using the <tab> key. By setting this option to a false value (0), this binding can be disabled.
METHODS
- new ( OPTIONS )
- layout ( )
- draw ( NODOUPDATE )
- focus ( )
-
These are standard methods. See Curses::UI::Widget for an explanation of these.
- get ( )
-
This method will return the index of the currently active button. If a value is given for that index (using the -values option, see above), that value will be returned.
DEFAULT BINDINGS
- <tab>
-
Call the 'loose-focus' routine. This will have the widget loose its focus. If you do not want the widget to loose its focus, you can disable this binding by using the -mayloosefocus option (see below).
- <enter>, <space>
-
Call the 'return' routine. By default this routine will have the container in which the widget is loose its focus. If you do not like this behaviour, then you can have it loose focus itself by calling:
$buttonswidget->set_routine('return', 'RETURN');
For an explanation of this, see Curses::UI::Common.
- <cursor left>, <h>
-
Call the 'previous' routine. This will make the previous button the active button. If the active button already is the first button, nothing will be done.
- <cursor right>, <l
-
Call the 'next' routine. This will make the next button the active button. If the next button already is the last button, nothing will be done.
- <any other key>
-
This will call the 'shortcut' routine. This routine will handle the shortcuts that are set by the -shortcuts option.
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.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 450:
'=end' without a target?