menu_driver - main menu handling function
Curses Menu Library (libmenu, -lmenu)
menu_driver(MENU *menu, int c);
The menu_driver() function is the guts of the menu system. It takes the
commands passed by c parameter and performs the requested action on the
menu given. The following commands may be given to the menu driver:
REQ_LEFT_ITEM Sets the new current item to be the item to the left
of the current item.
REQ_RIGHT_ITEM Sets the new current item to be the item to the rights
of the current item.
REQ_UP_ITEM Sets the new current item to be the item above the
REQ_DOWN_ITEM Sets the new current item to be the item below the
REQ_SCR_ULINE Scroll the menu one line towards the bottom of the
menu window. The new current item becomes the item
immediately above the current item.
REQ_SCR_DLINE Scroll the menu one line towards the top of the menu
window. The new current item becomes the item immediately
below the current item.
REQ_SCR_DPAGE Scroll the menu one page towards the bottom of the
REQ_SCR_UPAGE Scroll the menu one page towards the top of the menu
REQ_FIRST_ITEM Set the current item to be the first item in the menu.
REQ_LAST_ITEM Set the current item to be the last item in the menu.
REQ_NEXT_ITEM Set the new current item to be the next item in the
item array after the current item.
REQ_PREV_ITEM Set the new current item to be the item before the
current item in the items array.
REQ_TOGGLE_ITEM If the item is selectable then toggle the item's
REQ_CLEAR_PATTERN Clear all the characters currently in the menu's pattern
REQ_BACK_PATTERN Remove the last character from the pattern buffer.
REQ_NEXT_MATCH Attempt to find the next item that matches the pattern
REQ_PREV_MATCH Attempt to find the previous item that matches the
If menu_driver() is passed a command that is greater than MAX_COMMAND
then the command passed is assumed to be a user defined command and
menu_driver() returns E_UNKNOWN_COMMAND. Otherwise if the command is a
printable character then the character represented by the command is
placed at the end of the pattern buffer and an attempt is made to match
the pattern buffer against the items in the menu.
The functions return one of the following error values:
E_OK The function was successful.
E_SYSTEM_ERROR There was a system error during the call.
E_BAD_ARGUMENT One or more of the arguments passed to the function
E_NOT_POSTED The menu is not posted.
E_UNKNOWN_COMMAND The menu driver does not recognise the request passed
E_NO_MATCH The character search failed to find a match.
E_NOT_CONNECTED The item is not connected to a menu.
E_REQUEST_DENIED The menu driver could not process the request.
The header <menu.h> automatically includes both <curses.h> and <eti.h>.
BSD September 10, 1999 BSD
[ Back ]