menu_value(3MENU)

ok so we're in the 3MENU manual, library calls section, and today's topic is set_item_value and item_value β€” the little duo that sets and gets menu item values. yes they're a pair. yes they slay. let's go πŸ’…


✨ NAME ✨

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

like. that's it. that's the whole job. one sets, one gets, they're giving complementary energy 🫢


🌸 SYNOPSIS 🌸

#include <menu.h>

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

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea β˜•

by default a menu is a "pick one, bestie" situation β€” but if you turn off the menu option O_ONEVALUE (you can do that with set_menu_opts or menu_opts_off, go peek at opts(3MENU) if you wanna know more), the menu goes multi-valued ✨ which literally means more than one item may simultaneously be selected. yes. multiple. at the same time. the menu is poly now, we love that for it πŸ’œ

and in a multi-valued menu, you can use set_item_value to:

  • select the given menu item β€” second argument is TRUE βœ…
  • deselect it β€” second argument is FALSE ❌

that's the whole vibe check. TRUE = in, FALSE = out, no cap πŸŽ€


πŸ‘‘ RETURN VALUE πŸ‘‘

set_item_value comes back with one of these, and honestly they're each giving a little something:

  • E_OK β€” the routine succeeded. periodt. iconic. no notes πŸ’…
  • 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 are emulating the System V menu library β€” so they're doing a little vintage cosplay 🧚

they were not supported on Version 7 or BSD versions. like, at all. nope. not invited to that party πŸ™ˆ


πŸ’œ AUTHORS πŸ’œ

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

thank you for your service, kings πŸ‘‘


πŸ“ SEE ALSO πŸ“

  • ncurses(3NCURSES)
  • menu(3MENU)

and that's the whole page, bestie πŸŽ€ this was ncurses 6.6, dated 2024-03-16, and it ate, fr fr ✨ go forth and select multiple things simultaneously, you've earned it πŸ’–πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from