curses extension for programming menus 

Curses Function


#include <menu.h>


The menus library provides terminal-independent facilities for composing menu systems on character-cell terminals. The library includes: item routines, which create and modify menu items; and menu routines, which group items into menus, display menus on the screen, and handle interaction with the user.

The menus library uses the curses libraries, and a curses initialization routine such as initscr() must be called before using any of these functions. To use the menus library, link with the options -lmenu -lcurses.

The menus library maintains a default value for item attributes. You can get or set this default by calling the appropriate get_ or set_ routine with a NULL item pointer. Changing this default with a set_ char affects future item creations, but does not change the rendering of items already created.

Routine Name Index

The following table lists each menu routine and the name of the manual page on which it is described.

       curses Routine Name    Manual Page Name
       current_item	      mitem_current()
       free_item	      mitem_new()
       free_menu	      menu_new()
       item_count	      menu_items()
       item_description	      mitem_name()
       item_index	      mitem_current()
       item_init	      menu_hook()
       item_name	      mitem_name()
       item_opts	      mitem_opts()
       item_opts_off	      mitem_opts()
       item_opts_on	      mitem_opts()
       item_term	      menu_hook()
       item_userptr	      mitem_userptr()
       item_value	      mitem_value()
       item_visible	      mitem_visible()
       menu_back	      menu_attribs()
       menu_driver	      menu_driver()
       menu_fore	      menu_attribs()
       menu_format	      menu_format()
       menu_grey	      menu_attribs()
       menu_init	      menu_hook()
       menu_items	      menu_items()
       menu_mark	      menu_mark()
       menu_opts	      menu_opts()
       menu_opts_off	      menu_opts()
       menu_opts_on	      menu_opts()
       menu_pad		      menu_attribs()
       menu_pattern	      menu_pattern()
       menu_request_by_name   menu_requestname()
       menu_request_name      menu_requestname()
       menu_spacing	      menu_spacing()
       menu_sub		      menu_win()
       menu_term	      menu_hook()
       menu_userptr	      menu_userptr()
       menu_win		      menu_win()
       new_item		      mitem_new()
       new_menu		      menu_new()
       pos_menu_cursor	      menu_cursor()
       post_menu	      menu_post()
       scale_menu	      menu_win()
       set_current_item	      menu_current_item()
       set_item_init	      menu_hook()
       set_item_opts	      mitem_opts()
       set_item_term	      menu_hook()
       set_item_userptr	      mitem_userptr()
       set_item_value	      mitem_value()
       set_menu_back	      menu_attribs()
       set_menu_fore	      menu_attribs()
       set_menu_format	      menu_format()
       set_menu_grey	      menu_attribs()
       set_menu_init	      menu_hook()
       set_menu_items	      menu_items()
       set_menu_mark	      menu_mark()
       set_menu_opts	      mitem_opts()
       set_menu_pad	      menu_attribs()
       set_menu_pattern	      menu_pattern()
       set_menu_spacing	      menu_spacing()
       set_menu_sub	      menu_win()
       set_menu_term	      menu_hook()
       set_menu_userptr	      menu_userptr()
       set_menu_win	      menu_win()
       set_top_row	      mitem_current()
       top_row		      mitem_current()
       unpost_menu	      menu_post()


Routines that return pointers return NULL on error. Routines that return an integer return one of the following error codes:


The routine succeeded.


System error occurred.


Routine detected an incorrect or out-of-range argument.


The menu is already posted.


Routine was called from an initialization or termination function.


Menu is too large for its window.


The menu has not been posted.


The menu driver code saw an unknown request code.


Character failed to match.


The designated item cannot be selected.


No items are connected to the menu.


The menu driver could not process the request.


The header file <menu.h> automatically includes the header files <curses.h> and <eti.h>.

In your library list, libmenu.a should be before libncurses.a; that is, you want to say -lmenu -lncurses, not the other way around (which would give you a link error using GNU ld and many other linkers).


These routines emulate the System V menu library. They were not supported on Version 7 or BSD versions.


Juergen Pfeifer. Manual pages and adaptation for ncurses by Eric S. Raymond.


PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


curses(), menu_attribs(), menu_cursor(), menu_driver(), menu_format(), menu_hook(), menu_items(), menu_mark(), menu_new(), menu_opts(), menu_pattern(), menu_post(), menu_requestname(), menu_spacing(), menu_userptr(), menu_win()

PTC MKS Toolkit 10.3 Documentation Build 39.