mitem_current(3X)

๐Ÿ“ฆ version 15.1, in freebsd 14.5, freebsd 15.1

okay bestie, welcome to mitem_current(3X) โ€” this one lives in the Library calls section, and itโ€™s literally all about setting and getting the current menu item. ๐ŸŽ€

๐ŸŽ€ 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 ๐Ÿ’…

okay so bestie, hereโ€™s the tea: set_current_item sets the current item โ€” aka the item on which the menu cursor is positioned. current_item returns a pointer to the current item in the given menu. main character behavior, no cap. ๐ŸŒŸ

set_top_row sets the top row of the menu to show the given row. The top row is initially 0, and it is reset to this value whenever the O_ROWMAJOR option is toggled. The item leftmost on the given row becomes current. top_row returns the number of the top menu row being displayed. slay. ๐Ÿฆ‹

item_index returns the (zero-origin) index of item in the menuโ€™s item pointer list. iykyk. ๐Ÿ”ฅ


๐Ÿ”ฎ RETURN VALUE ๐Ÿ”ฎ

current_item returns a pointer (which may be NULL). It does not set errno. ngl, that part matters. ๐Ÿ™ˆ

top_row and item_index return ERR (the general curses error value) if their menu parameter is NULL. yes, fr fr. ๐Ÿ’€

set_current_item and set_top_row return one of the following:

  • E_OK โ€” the routine succeeded. periodt. โœจ
  • E_BAD_ARGUMENT โ€” routine detected an incorrect or out-of-range argument. not the vibe. ๐Ÿ˜ญ
  • E_BAD_STATE โ€” routine was called from an initialization or termination function. wrong moment, bestie. ๐Ÿซ 
  • E_NOT_CONNECTED โ€” no items are connected to the menu. itโ€™s giving empty group chat. ๐Ÿ’€
  • E_SYSTEM_ERROR โ€” system error occurred (see errno(3)). go check errno(3), bestie. ๐Ÿ”

๐ŸŒˆ PORTABILITY ๐ŸŒˆ

These routines emulate the System V menu library. They were not supported on Version 7 or BSD versions. history lesson, but make it menu. ๐Ÿ“œ

The SVr4 menu library documentation specifies the top_row and index_item error value as -1 (which is the value of ERR). yes, it says index_item there โ€” weโ€™re keeping it exactly as the page says. ๐Ÿ‘€


๐Ÿ‘‘ AUTHORS ๐Ÿ‘‘

Juergen Pfeifer. Manual pages and adaptation for new curses by Eric S. Raymond. icons only. ๐Ÿซถ


๐ŸŒธ SEE ALSO ๐ŸŒธ

curses(3X), menu(3X) โ€” go read those too, bestie. ๐Ÿ’–


and thatโ€™s a wrap, bestie! ๐Ÿซถ this page is from ncurses 6.5, dated 2024-12-28 โ€” mitem_current(3X) forever. periodt ๐Ÿ’…โœจ

๐Ÿ“ฆ where this page comes from