menu(3MENU)
π menu(3MENU) β Library calls π
okay bestie, sit DOWN, because this is the menu(3MENU) page and it's genuinely one of the most useful things in the whole curses cinematic universe π
β¨ NAME β¨
menu β present menus in curses windows. that's it, that's the vibe πΈ
β¨ SYNOPSIS β¨
#include <menu.h>
β¨ DESCRIPTION β¨
so the menu library gives you terminal-independent facilities for composing menu systems on character-cell terminals. it's giving "build a whole interactive UI and don't worry about which terminal you're on" energy β¨
it comes in two flavors of routine:
- item routines β they create and modify menu items.
- menu routines β they group items into menus, display menus on the screen, and handle interaction with the user.
the menu library uses the curses libraries, so you have to call a curses initialization routine such as initscr before using any of these functions. no initscr, no menu, no exceptions, periodt π€
and to actually use the menu library, link with the options -lmenu -lcurses. don't forget the -lcurses bestie, i'm begging π
π Current Default Values for Item Attributes π
the menu 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 π
β οΈ heads up: changing this default with a set_ function affects future item creations, but does not change the rendering of items already created. the past is the past, bestie π
π¦ Routine Name Index π¦
the following list covers each menu routine and the name of the manual page on which it is described. the original calls the columns curses Routine Name and Manual Page Name β here they are, one icon per line π
current_itemβmenu_current(3MENU)free_itemβmenu_new(3MENU)free_menuβnew(3MENU)item_countβitems(3MENU)item_descriptionβmenu_name(3MENU)item_indexβmenu_current(3MENU)item_initβhook(3MENU)item_nameβmenu_name(3MENU)item_optsβmenu_opts(3MENU)item_opts_offβmenu_opts(3MENU)item_opts_onβmenu_opts(3MENU)item_termβhook(3MENU)item_userptrβmenu_userptr(3MENU)item_valueβmenu_value(3MENU)item_visibleβmenu_visible(3MENU)menu_backβattributes(3MENU)menu_driverβdriver(3MENU)menu_foreβattributes(3MENU)menu_formatβformat(3MENU)menu_greyβattributes(3MENU)menu_initβhook(3MENU)menu_itemsβitems(3MENU)menu_markβmark(3MENU)menu_optsβopts(3MENU)menu_opts_offβopts(3MENU)menu_opts_onβopts(3MENU)menu_padβattributes(3MENU)menu_patternβpattern(3MENU)menu_request_by_nameβrequestname(3MENU)menu_request_nameβrequestname(3MENU)menu_spacingβspacing(3MENU)menu_subβwin(3MENU)menu_termβhook(3MENU)menu_userptrβuserptr(3MENU)menu_winβwin(3MENU)new_itemβmenu_new(3MENU)new_menuβnew(3MENU)pos_menu_cursorβcursor(3MENU)post_menuβpost(3MENU)scale_menuβwin(3MENU)set_current_itemβmenu_current(3MENU)set_item_initβhook(3MENU)set_item_optsβmenu_opts(3MENU)set_item_termβhook(3MENU)set_item_userptrβmenu_userptr(3MENU)set_item_valueβmenu_value(3MENU)set_menu_backβattributes(3MENU)set_menu_foreβattributes(3MENU)set_menu_formatβformat(3MENU)set_menu_greyβattributes(3MENU)set_menu_initβhook(3MENU)set_menu_itemsβitems(3MENU)set_menu_markβmark(3MENU)set_menu_optsβmenu_opts(3MENU)set_menu_padβattributes(3MENU)set_menu_patternβpattern(3MENU)set_menu_spacingβspacing(3MENU)set_menu_subβwin(3MENU)set_menu_termβhook(3MENU)set_menu_userptrβuserptr(3MENU)set_menu_winβwin(3MENU)set_top_rowβmenu_current(3MENU)top_rowβmenu_current(3MENU)unpost_menuβpost(3MENU)
iykyk, that's the whole squad π«Ά
β¨ RETURN VALUE β¨
routines that return pointers return NULL on error. routines that return an integer return one of these error codes, and bestie, you're gonna want to memorize these π
E_OKβ the routine succeeded. slay πE_BAD_ARGUMENTβ routine detected an incorrect or out-of-range argument. πE_BAD_STATEβ routine was called from an initialization or termination function. wrong place, wrong time πE_NO_MATCHβ character failed to match.E_NO_ROOMβ menu is too large for its window. it's giving claustrophobia π«E_NOT_CONNECTEDβ no items are connected to the menu.E_NOT_POSTEDβ the menu has not been posted.E_NOT_SELECTABLEβ the designated item cannot be selected.E_POSTEDβ the menu is already posted. relax, it's already up there βE_REQUEST_DENIEDβ the menu driver could not process the request.E_SYSTEM_ERRORβ system error occurred (seeerrno(3)).E_UNKNOWN_COMMANDβ the menu driver code saw an unknown request code. who even are you π
β¨ NOTES β¨
the header file menu.h itself includes the header file curses.h. so like, it's already in the group chat π₯°
β¨ PORTABILITY β¨
these routines emulate the System V menu library. they were not supported on Version 7 or BSD versions. history lesson, sorry bestie π
a menu facility was documented in SVr4.2's Character User Interface Programming document.
it is not part of X/Open Curses. nope, not invited π«
aside from ncurses, there are few implementations:
- systems based on SVr4 source code, e.g., Solaris.
- NetBSD curses.
so yeah, it's a small circle. exclusive fr fr π
β¨ AUTHORS β¨
Juergen Pfeifer. manual pages and adaptation for ncurses by Eric S. Raymond. absolute icons, no cap π
β¨ SEE ALSO β¨
ncurses(3NCURSES) and related pages whose names begin βmenu_β for detailed descriptions of the entry points. go read those next, bestie, they're the deep lore π¦
and that's the whole page!! this was ncurses 6.6, dated 2025-11-11, dropping under the name menu(3MENU) β stay cutesy, stay curses-y, and don't forget initscr πβ¨π
π¦ where this page comes from
- ubuntu resolute: ncurses-doc 6.6+20251231-1 Β· MIT/X11
- ubuntu stonking: ncurses-doc 6.6+20260608-2 Β· MIT/X11
- Copyright 2018-2024,2025 Thomas E. Dickey
- Copyright 1998-2014,2017 Free Software Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms