Curses::UI::Widget | +----Curses::UI::Popupmenu
use Curses::UI; my $cui = new Curses::UI; my $win = $cui->add('window_id', 'Window'); my $popupbox = $win->add( 'mypopupbox', 'Popupmenu', -values => [1, 2, 3], -labels => { 1 => 'One', 2 => 'Two', 3 => 'Three' }, ); $popupbox->focus(); my $value = $popupbox->get();
Normally the widget will look something like this:
[Current value ]
If the popup window is opened, it looks something like this:
[Current value ] +--------------+ |Other value | |Current value | |Third value | +--------------+
For an explanation of these standard options, see Curses::UI::Widget.
These options are exactly the same as the options for the Listbox widget. So for an explanation of these, take a look at Curses::UI::Listbox.
This sets the onChange event handler for the popupmenu widget. If a new item is selected, the code in CODEREF will be executed. It will get the widget reference as its argument.
These are standard methods. See Curses::UI::Widget for an explanation of these.
This method will return the currently selected value.
This method will return the index of the currently selected value.
This method marks the item at the position specified as selected.
This method can be used to set the -onchange event handler (see above) after initialization of the popupmenu.
Call the 'loose-focus' routine. This will have the widget loose its focus.
Call the 'open-popup' routine. This will show the popup listbox and bring the focus to this listbox. See The popup listbox below for a description of the bindings for this listbox.
Call the 'select-next' routine. This will select the item in the list that is after the currently selected item (unless the last item is already selected). If no item is selected, the first item in the list will get selected.
Call the 'select-prev' routine. This will select the item in the list that is before the currently selected item (unless the first item is already selected). If no item is selected, the first item in the list will get selected.
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.