opts(3MENU)

✨ opts β€” the menu options glow-up πŸ’…

okay bestie, welcome to opts from the menu library, aka section 3MENU of your friendly neighborhood manual pages. this is where you flip the little switches that decide how your menu behaves. lowkey iconic, highkey essential. let's get into it 🫢


🌸 NAME 🌸

set_menu_opts, menu_opts_on, menu_opts_off, menu_opts β€” set and get menu options ✨


πŸŽ€ SYNOPSIS πŸŽ€

#include <menu.h>

int set_menu_opts(MENU *menu, Menu_Options opts);
Menu_Options menu_opts(const MENU *menu);

int menu_opts_on(MENU *menu, Menu_Options opts);
int menu_opts_off(MENU *menu, Menu_Options opts);

like, copy that include line first or nothing works, that's the vibe check βœ…


πŸ’– DESCRIPTION πŸ’–

okay so, four functions, four whole moods:

  • set_menu_opts β€” sets all of the given menu's option bits. and yes, menu option bits can be logically "or"-ed together, so you can stack them like charms on a bracelet. πŸ”₯
  • menu_opts_on β€” turns on the given option bits and leaves everything else exactly where it was. no notes.
  • menu_opts_off β€” turns off the given option bits and leaves everything else alone. it's giving "mind your own business" energy.
  • menu_opts β€” just hands you the menu's current option bits. the nosy bestie of the group. πŸ‘€

πŸ¦‹ the options, bestie πŸ¦‹

here's the tea β€” the following options are defined, and all of them are on by default. so if you want chaos, you gotta turn stuff off. periodt.

  • O_ONEVALUE β€” only one item can be selected for this menu. monogamous menu behavior πŸ’œ
  • O_SHOWDESC β€” display the item descriptions when the menu is posted. show off a little. ✨
  • O_ROWMAJOR β€” display the menu in row-major order. rows first, that's the arrangement. πŸ“
  • O_IGNORECASE β€” ignore the case when pattern-matching. A and a are literally the same thing here, we don't discriminate. πŸ™ˆ
  • O_SHOWMATCH β€” move the cursor to within the item name while pattern-matching. cursor said "i'm gonna stand right here" πŸ’…
  • O_NONCYCLIC β€” don't wrap around next-item and previous-item requests to the other end of the menu. no looping, no sneaky teleporting to the top. it's a one-way street, bestie. 🚫
  • O_MOUSE_MENU β€” if the user clicks with the mouse and it does not fall on the currently active menu, push KEY_MOUSE and the MEVENT data back on the queue to allow processing in another part of the calling program. basically it's like "not my department, here, you deal with it" πŸ–±οΈ

πŸ’€ RETURN VALUE πŸ’€

except for menu_opts (she's different, she's the exception, main character energy πŸ‘‘), each routine returns one of these:

  • E_OK β€” the routine succeeded. slay. βœ…
  • E_SYSTEM_ERROR β€” system error occurred (see errno(3)). uh oh. 😭
  • E_POSTED β€” the menu is already posted. sorry babe, can't do it now. πŸ“Œ

🌈 PORTABILITY 🌈

these routines emulate the System V menu library. they were not supported on Version 7 or BSD versions. so if you're kicking it old-school like that, this is not the function set for you, ngl. πŸ•°οΈ


🧚 AUTHORS 🧚

Juergen Pfeifer. Manual pages and adaptation for new curses by Eric S. Raymond. kings of documentation, we thank them. 🫢


⭐ SEE ALSO ⭐

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

fr fr bestie, remember: all those options come on by default, so if your menu is acting a certain way, check which bits you flipped before you blame the library πŸ’–

mwah, that's the whole page β€” go forth and configure your menus, you got this πŸ’…βœ¨

β€” ncurses 6.6, dated 2025-01-18, signing off πŸŽ€πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from