mitem_value(3X)

πŸ’– mitem_value(3X) πŸ’–

okay bestie, gather round, because today we're talking about mitem_value(3X) β€” the library call that's all about setting and getting your menu item values. two lil functions, set_item_value and item_value, and they're literally the moment your menu stops being a one-trick pony. ✨


🌸 NAME 🌸

set_item_value, item_value β€” set and get menu item values πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <menu.h>

int set_item_value(ITEM *item, bool value);
bool item_value(const ITEM *item);

no cap, that's the whole thing. two lines. iconic. πŸ’…


πŸ‘‘ DESCRIPTION πŸ‘‘

okay so here's the tea. by default a menu is like... one of those friend groups where only one person gets to talk at a time. turn off the menu option O_ONEVALUE (you can do that with set_menu_opts or menu_opts_off β€” go peek at menu_opts(3X), it's giving lore) and suddenly the menu becomes multi-valued, which means more than one item may simultaneously be selected. yes bestie, MULTIPLE. we contain multitudes. 🫢

so in a multi-valued menu, you get to use set_item_value to select the given menu item β€” that's the second argument being TRUE β€” or deselect it β€” second argument FALSE. that's it, that's the whole vibe. you point at an item, you say yes or no, the menu listens. main character energy fr fr. πŸ’–


⭐ RETURN VALUE ⭐

the function set_item_value returns one of these bad boys:

  • E_OK β€” the routine succeeded. slay. we ate. πŸŽ‰
  • E_SYSTEM_ERROR β€” a system error occurred (go check errno(3), bestie, it knows what happened 😭)
  • E_REQUEST_DENIED β€” the menu driver could not process the request. it said no. respectfully. πŸ’€

🌈 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 to those, sorry babes, you're on your own. πŸ™ˆ


πŸ’œ AUTHORS πŸ’œ

Juergen Pfeifer. manual pages and adaptation for new curses by Eric S. Raymond. kings. πŸ‘‘


πŸŽ€ SEE ALSO πŸŽ€

  • curses(3X)
  • menu(3X)

lowkey reminder bestie: item_value gets, set_item_value sets. don't mix them up or the vibe check will fail. πŸ“

and that's the page!! brought to you by ncurses 6.6, dated 2024-03-16 β€” mwah, tysm for reading, now go forth and select multiple items at once like the multi-valued icon you are πŸ§šπŸ’…βœ¨

πŸ“¦ where this page comes from