|
Curses::Menu - display menus for selecting items using Curses |
Curses::Menu - display menus for selecting items using Curses
use Curses::Menu;
my $menu = new Curses::Menu(title => "A Menu");
$menu->additem("Item One");
$menu->additem("Item Two" => 2);
$menu->addescape(KEY_ESC, "Cancel", MENU_RETURN, MENU_CANCEL);
$menu->addescape(KEY_ENTER, "Select", MENU_RETURN, MENU_OK);
$menu->addescape(ORD('j'), undef, MENU_CALL, \&MENU_UP);
$menu->addescape(KEY_UP, "Prev Item", MENU_CALL, \&MENU_UP);
$menu->selected($value);
$menu->display($window);
if ($menu->escape() == MENU_OK) {
$r3 = $menu->selected();
}
Curses::Menu implements a flexible text menu system. An object of this class represents a menu.
The following method constructs a Curses::Menu object:
The following options are supported:
The methods described in this section can be called on a Curses::Method object.
This module only implements 3 actions: MENU_ACTION_NOP, MENU_ACTION_CALL and MENU_ACTION_RETURN.
MENU_ACTION_NOP does nothing (and supresses the unknown key beep as a result).
MENU_ACTION_CALL calls the subref specified in the argument field with the object reference as its first argument.
MENU_ACTION_RETURN causes the menu to return, setting the escape value to the argument.
escape()selected()
The module defines a number of useful callbacks which you will probably want to use with your menu.
Written by Chris Collins <xfire@xware.cx>.
Inspired partially by the long obsolete perlmenu package and my boss.
|
Curses::Menu - display menus for selecting items using Curses |