menu_current(3MENU)
menu_current(3MENU) π the library-calls girlies know
okay so bestie, welcome to the 3MENU corner of the manual β this is a library call page and it's about which item the cursor is vibing on and which row is at the top. buckle up π
β¨ NAME β¨
mitem_current β set and get current_menu_item π
β¨ SYNOPSIS β¨
#include <menu.h>
int set_current_item(MENU *menu, ITEM *item);
ITEM *current_item(const MENU *menu);
int set_top_row(MENU *menu, int row);
int top_row(const MENU *menu);
int item_index(const ITEM *item);
β¨ DESCRIPTION β¨
so, first up: set_current_item sets the current item β that's the item the menu cursor is sitting on, main character energy only π. and current_item hands you back a pointer to the current item in the menu you passed in. easy.
then we've got set_top_row, which sets the top row of the menu so it displays the row you asked for. heads up bestie: the top row starts at 0, and it gets reset back to that value whenever the O_ROWMAJOR option is toggled π. the item leftmost on the given row becomes current. and top_row returns the number of the top menu row that's currently being displayed.
last one: item_index returns the zero-origin index of item in the menu's item pointer list. zero-origin means it counts from 0, not 1, no cap π
β¨ RETURN VALUE β¨
current_itemreturns a pointer β and yeah, it may beNULL. it does not seterrno.top_rowanditem_indexreturnERR(the general curses error value) if theirmenuparameter isNULL. πset_current_itemandset_top_rowreturn one of these:E_OKβ the routine succeeded. slay β¨E_BAD_ARGUMENTβ the routine detected an incorrect or out-of-range argument. πE_BAD_STATEβ the routine was called from an initialization or termination function. wrong place, wrong time fr frE_NOT_CONNECTEDβ no items are connected to the menu. it's giving empty πE_SYSTEM_ERRORβ a system error occurred (seeerrno(3)).
β¨ PORTABILITY β¨
these routines emulate the System V menu library. they were not supported on Version 7 or BSD versions, so if you're time-traveling back there, good luck bestie π°οΈ
also, the SVr4 menu library documentation specifies the top_row and index_item error value as -1 β which, fun fact, is the value of ERR π€
β¨ AUTHORS β¨
Juergen Pfeifer. manual pages and adaptation for new curses by Eric S. Raymond. kings π
β¨ SEE ALSO β¨
ncurses(3NCURSES), menu(3MENU) π¦
and that's the whole page, bestie!! this was ncurses 6.6, dated 2024-12-28, on the menu_current(3MENU) page β mwah, go read menu(3MENU) next, ily ππΈ
π¦ 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-2023,2024 Thomas E. Dickey
- Copyright 1998-2006,2010 Free Software Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms