Curses::UI::Listbox - Create and manipulate listbox widgets
|
Curses::UI::Listbox - Create and manipulate listbox widgets
Curses::UI::Widget
Curses::UI::Searchable
|
+----Curses::UI::Listbox
use Curses::UI;
my $cui = new Curses::UI;
my $win = $cui->add('window_id', 'Window');
my $listbox = $win->add(
'mylistbox', 'Listbox',
-values => [1, 2, 3],
-labels => { 1 => 'One',
2 => 'Two',
3 => 'Three' },
-radio => 1,
);
$listbox->focus();
my $selected = $listbox->get();
Curses::UI::Listbox is a widget that can be used to create
a couple of different kinds of listboxes. These are:
- default listbox
A list of values through which can be browsed. One of these
values can be selected. The selected value will be
highlighted. This kind of listbox looks somewhat like this:
+------+
|One |
|Two |
|Three |
+------+
- multi-select listbox
This is also a list of values, but now more than one
value can be selected at once. This kind of listbox
looks somewhat like this:
+----------+
|[X] One |
|[ ] Two |
|[X] Three |
+----------+
- radiobutton listbox
This looks a lot like the default listbox (only one
value can be selected), but now there is clear
visual feedback on which value is selected. Before
each value ``< >'' is printed. If a value is selected,
``<o>'' is printed instead. This kind of listbox
looks somewhat like this:
+----------+
|< > One |
|<o> Two |
|< > Three |
+----------+
- Listbox Markup
The listbox supports a primitive markup language to emphasize
entries:
<reverse>reverse text</reverse>
<bold>bold text</bold>
<underline>underlined text</underline>
<blink>blinking text</blink>
<dim>dim text</dim>
By using this markup tokens in the values array, you can make the
listbox draw the text in the according way. To enable the parser,
you have to create the listbox with the -htmltext option.
-parent, -x, -y, -width, -height,
-pad, -padleft, -padright, -padtop, -padbottom,
-ipad, -ipadleft, -ipadright, -ipadtop, -ipadbottom,
-title, -titlefullwidth, -titlereverse, -onfocus,
-onblur
For an explanation of these standard options, see
Curses::UI::Widget.
- <cursor-left>, <h>, <tab>
Call the 'loose-focus' routine. This will have the widget
loose its focus.
- <cursor-right, <l>, <enter>, <space>
Call the 'option-select' routine. This will select the
active item in the listbox.
- <1>, <y>
Call the 'option-check' routine. If the listbox is a
multi-select listbox, the active item will become checked
and the next item will become active.
- <0>, <n>
Call the 'option-uncheck' routine. If the listbox is a
multi-select listbox, the active item will become unchecked
and the next item will become active.
- <cursor-down>, <j>
Call the 'option-next' routine. This will make the next
item of the list active.
- <cursor-up>, <k>
Call the 'option-prev' routine. This will make the previous
item of the list active.
- <page-up>
Call the 'option-prevpage' routine. This will make the item
on the previous page active.
- <page-down>
Call the 'option-nextpage' routine. This will make the item
on the next page active.
- <home>, <CTRL+A>
Call the 'option-first' routine. This will make the first
item of the list active.
- <end>, <CTRL+E>
Call the 'option-last' routine. This will make the last
item of the list active.
- </>
Call the 'search-forward' routine. This will make a 'less'-like
search system appear in the listbox. A searchstring can be
entered. After that the user can search for the next occurance
using the 'n' key or the previous occurance using the 'N' key.
- <?>
Call the 'search-backward' routine. This will do the same as
the 'search-forward' routine, only it will search in the
opposite direction.
Curses::UI,
Curses::UI::Widget,
Curses::UI::Common
Copyright (c) 2001-2002 Maurice Makaay. All rights reserved.
Maintained by Marcus Thiesen (marcus@cpan.thiesenweb.de)
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.
Curses::UI::Listbox - Create and manipulate listbox widgets
|