.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Curses::UI::Listbox 3pm" .TH Curses::UI::Listbox 3pm "2021-01-01" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Curses::UI::Listbox \- Create and manipulate listbox widgets .SH "CLASS HIERARCHY" .IX Header "CLASS HIERARCHY" .Vb 4 \& Curses::UI::Widget \& Curses::UI::Searchable \& | \& +\-\-\-\-Curses::UI::Listbox .Ve .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& use Curses::UI; \& my $cui = new Curses::UI; \& my $win = $cui\->add(\*(Aqwindow_id\*(Aq, \*(AqWindow\*(Aq); \& \& my $listbox = $win\->add( \& \*(Aqmylistbox\*(Aq, \*(AqListbox\*(Aq, \& \-values => [1, 2, 3], \& \-labels => { 1 => \*(AqOne\*(Aq, \& 2 => \*(AqTwo\*(Aq, \& 3 => \*(AqThree\*(Aq }, \& \-radio => 1, \& ); \& \& $listbox\->focus(); \& my $selected = $listbox\->get(); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Curses::UI::Listbox is a widget that can be used to create a couple of different kinds of listboxes. These are: .IP "\(bu" 4 \&\fBdefault listbox\fR .Sp 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: .Sp .Vb 5 \& +\-\-\-\-\-\-+ \& |One | \& |Two | \& |Three | \& +\-\-\-\-\-\-+ .Ve .IP "\(bu" 4 \&\fBmulti-select listbox\fR .Sp 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: .Sp .Vb 5 \& +\-\-\-\-\-\-\-\-\-\-+ \& |[X] One | \& |[ ] Two | \& |[X] Three | \& +\-\-\-\-\-\-\-\-\-\-+ .Ve .IP "\(bu" 4 \&\fBradiobutton listbox\fR .Sp 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 \*(L"< >\*(R" is printed. If a value is selected, \&\*(L"\*(R" is printed instead. This kind of listbox looks somewhat like this: .Sp .Vb 5 \& +\-\-\-\-\-\-\-\-\-\-+ \& |< > One | \& | Two | \& |< > Three | \& +\-\-\-\-\-\-\-\-\-\-+ .Ve .IP "\(bu" 4 \&\fBListbox Markup\fR .Sp The listbox supports a primitive markup language to emphasize entries: reverse text bold text underlined text blinking text dim text 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. .SH "STANDARD OPTIONS" .IX Header "STANDARD OPTIONS" \&\fB\-parent\fR, \fB\-x\fR, \fB\-y\fR, \fB\-width\fR, \fB\-height\fR, \&\fB\-pad\fR, \fB\-padleft\fR, \fB\-padright\fR, \fB\-padtop\fR, \fB\-padbottom\fR, \&\fB\-ipad\fR, \fB\-ipadleft\fR, \fB\-ipadright\fR, \fB\-ipadtop\fR, \fB\-ipadbottom\fR, \&\fB\-title\fR, \fB\-titlefullwidth\fR, \fB\-titlereverse\fR, \fB\-onfocus\fR, \&\fB\-onblur\fR .PP For an explanation of these standard options, see Curses::UI::Widget. .SH "WIDGET-SPECIFIC OPTIONS" .IX Header "WIDGET-SPECIFIC OPTIONS" .IP "\(bu" 4 \&\fB\-values\fR < \s-1ARRAYREF\s0 > .Sp This option sets the values to use. Unless a label is set for the value (see \fB\-labels\fR), this value will be shown in the list. .IP "\(bu" 4 \&\fB\-labels\fR < \s-1HASHREF\s0 > .Sp The keys of this hash reference correspond to the values of the listbox (see \fB\-values\fR). The values of the hash are the labels to show in the listbox. It's not obligatory to have a label defined for each value. You may even omit \-labels completely. .IP "\(bu" 4 \&\fB\-selected\fR < \s-1INDEX\s0 > .Sp In case the \fB\-multi\fR option is not set, \s-1INDEX\s0 is the index of the value that should be selected. .Sp In case the \fB\-multi\fR option is set, \s-1INDEX\s0 is a hash reference in which the keys are the indices of the \fB\-values\fR which are selected and the values are any true value. .IP "\(bu" 4 \&\fB\-multi\fR < \s-1BOOLEAN\s0 > .Sp If \s-1BOOLEAN\s0 has a true value, the listbox will be a multi-select listbox (see \s-1DESCRIPTION\s0). .IP "\(bu" 4 \&\fB\-radio\fR < \s-1BOOLEAN\s0 > .Sp If \s-1BOOLEAN\s0 has a true value, the listbox will be a radiobutton listbox (see \s-1DESCRIPTION\s0). .IP "\(bu" 4 \&\fB\-wraparound\fR < \s-1BOOLEAN\s0 > .Sp If \s-1BOOLEAN\s0 has a true value, wraparound is enabled. This means that if the listbox is on its last value and a key is pressed to go to the next value, the first value will be selected. Also the last value will be selected if this first value is selected and \*(L"goto previous value\*(R" is pressed. .IP "\(bu" 4 \&\fB\-onchange\fR < \s-1CODEREF\s0 > .Sp This sets the onChange event handler for the listbox widget. If a new item is selected, the code in \s-1CODEREF\s0 will be executed. It will get the widget reference as its argument. .IP "\(bu" 4 \&\fB\-onselchange\fR < \s-1CODEREF\s0 > .Sp This sets the onSelectionChange event handler for the listbox widget. If a new item is marked as active \s-1CODEREF\s0 will be executed. It will get the widget reference as its argument. .IP "\(bu" 4 \&\fB\-htmltext\fR < \s-1BOOLEAN\s0 > .Sp Make the Listbox parse primitive markup to change the items appearance. See above. .SH "METHODS" .IX Header "METHODS" .IP "\(bu" 4 \&\fBnew\fR ( \s-1OPTIONS\s0 ) .IP "\(bu" 4 \&\fBlayout\fR ( ) .IP "\(bu" 4 \&\fBdraw\fR ( \s-1BOOLEAN\s0 ) .IP "\(bu" 4 \&\fBintellidraw\fR ( ) .IP "\(bu" 4 \&\fBfocus\fR ( ) .IP "\(bu" 4 \&\fBonFocus\fR ( \s-1CODEREF\s0 ) .IP "\(bu" 4 \&\fBonBlur\fR ( \s-1CODEREF\s0 ) .Sp These are standard methods. See Curses::UI::Widget for an explanation of these. .IP "\(bu" 4 \&\fBget\fR ( ) .Sp This method will return the values of the currently selected items in the list. If the listbox is not a multi-select listbox only one value will be returned of course. .IP "\(bu" 4 \&\fBid\fR ( ) .Sp This method will return the index of the currently selected items in the list. If the listboy is not a multi-select listbox it will only return one value. .IP "\(bu" 4 \&\fBget_active_value\fR ( ) .Sp This method will return the value of the currently active (i.e highlighted line). .IP "\(bu" 4 \&\fBget_active_id\fR ( ) .Sp This method will return the index of the currently active (i.e highlighted line). .IP "\(bu" 4 \&\fBset_selection\fR ( \s-1LIST\s0 ) .Sp This method marks the items at the positions specified in \s-1LIST\s0 as selected. In a multi-select listbox you can set multiple items with giving multiple values, in a single-select listbox only the last item in \s-1LIST\s0 will be selected .IP "\(bu" 4 \&\fBclear_selection\fR ( ) .Sp This method clears the selected objects of a multi and radiobutton listbox. .IP "\(bu" 4 \&\fBvalues\fR ( \s-1ARRAYREF\s0 ) .Sp This method sets the values to use. .IP "\(bu" 4 \&\fBinsert_at\fR < \s-1POS,\s0 ARRAYREF|SCALAR > .Sp This method adds \s-1ARRAYREF\s0 or \s-1SCALAR\s0 into the list of values at pos. .IP "\(bu" 4 \&\fBlabels\fR [ \s-1HASHREF\s0 ] .Sp This method sets the labels to use. .IP "\(bu" 4 \&\fBadd_labels\fR [ \s-1HASHREF\s0 ] .Sp This method adds the given labels to the already defined ones. .IP "\(bu" 4 \&\fBonChange\fR ( \s-1CODEREF\s0 ) .Sp This method can be used to set the \fB\-onchange\fR event handler (see above) after initialization of the listbox. .IP "\(bu" 4 \&\fBonSelectionChange\fR ( \s-1CODEREF\s0 ) .Sp This method can be used to set the \fB\-onselchange\fR event handler (see above) after initialization of the listbox. .SH "DEFAULT BINDINGS" .IX Header "DEFAULT BINDINGS" .IP "\(bu" 4 <\fBcursor-left\fR>, <\fBh\fR>, <\fBtab\fR> .Sp Call the 'loose\-focus' routine. This will have the widget loose its focus. .IP "\(bu" 4 <\fBcursor-right\fR, <\fBl\fR>, <\fBenter\fR>, <\fBspace\fR> .Sp Call the 'option\-select' routine. This will select the active item in the listbox. .IP "\(bu" 4 <\fB1\fR>, <\fBy\fR> .Sp 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. .IP "\(bu" 4 <\fB0\fR>, <\fBn\fR> .Sp 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. .IP "\(bu" 4 <\fBcursor-down\fR>, <\fBj\fR> .Sp Call the 'option\-next' routine. This will make the next item of the list active. .IP "\(bu" 4 <\fBcursor-up\fR>, <\fBk\fR> .Sp Call the 'option\-prev' routine. This will make the previous item of the list active. .IP "\(bu" 4 <\fBpage-up\fR> .Sp Call the 'option\-prevpage' routine. This will make the item on the previous page active. .IP "\(bu" 4 <\fBpage-down\fR> .Sp Call the 'option\-nextpage' routine. This will make the item on the next page active. .IP "\(bu" 4 <\fBhome\fR>, <\fB\s-1CTRL+A\s0\fR> .Sp Call the 'option\-first' routine. This will make the first item of the list active. .IP "\(bu" 4 <\fBend\fR>, <\fB\s-1CTRL+E\s0\fR> .Sp Call the 'option\-last' routine. This will make the last item of the list active. .IP "\(bu" 4 <\fB/\fR> .Sp 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. .IP "\(bu" 4 <\fB?\fR> .Sp Call the 'search\-backward' routine. This will do the same as the 'search\-forward' routine, only it will search in the opposite direction. .SH "SEE ALSO" .IX Header "SEE ALSO" Curses::UI, Curses::UI::Widget, Curses::UI::Common .SH "AUTHOR" .IX Header "AUTHOR" Copyright (c) 2001\-2002 Maurice Makaay. All rights reserved. .PP Maintained by Marcus Thiesen (marcus@cpan.thiesenweb.de) .PP This package is free software and is provided \*(L"as is\*(R" without express or implied warranty. It may be used, redistributed and/or modified under the same terms as perl itself.