format(3MENU)

πŸ’– format(3MENU) β€” Library calls, bestie edition πŸ’–

ok so this is the format(3MENU) page from the ncurses library-calls girlies, and it's literally all about setting and getting your menu sizes. no cap. πŸŽ€


✨ NAME ✨

set_menu_format, menu_format β€” set and get menu sizes πŸ¦‹


✨ SYNOPSIS ✨

#include <menu.h>

int set_menu_format(MENU *menu, int rows, int cols);
void menu_format(const MENU *menu, int *rows, int *cols);

like. the whole vibe. two functions. one sets, one gets. iconic. πŸ’…


✨ DESCRIPTION ✨

okay so set_menu_format sets the maximum display size of the given menu. that's it, that's the job. ✨

if that size is too small to display all the menu items, the menu gets made scrollable. slay, adaptable queen.

but here's the tea tho πŸ‘€ β€” if this size is larger than the menu's subwindow and the subwindow is too small to display all the menu items, then post_menu will fail. so like, don't do that. fr fr. 😭

the default format is 16 rows, 1 column. and calling set_menu_format with a null menu pointer will change that default. wild, i know.

also: a zero row or column argument to set_menu_format is interpreted as a request not to change the current value. so zero = "leave it, bestie, it's fine." πŸ™ˆ

and menu_format? she returns the maximum-size constraints for the given menu into the storage addressed by rows and cols. simple. clean. we love her. πŸ’œ


✨ RETURN VALUE ✨

these routines return one of the following, and you will respect each one:

  • E_OK β€” the routine succeeded. πŸŽ‰ ate, no crumbs.
  • E_SYSTEM_ERROR β€” a system error occurred (see errno(3)). πŸ’€
  • E_BAD_ARGUMENT β€” the routine detected an incorrect or out-of-range argument. πŸ™ˆ
  • E_POSTED β€” the menu is already posted. πŸ‘‘
  • E_NOT_CONNECTED β€” no items are connected to the menu. 😭

✨ PORTABILITY ✨

these routines emulate the System V menu library. they were not supported on Version 7 or BSD versions. so like, historically they were giving niche. now they're everywhere. glow up. 🌈


✨ AUTHORS ✨

Juergen Pfeifer. πŸ’–

manual pages and adaptation for new curses by Eric S. Raymond. ✨


✨ SEE ALSO ✨

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

lowkey the whole point: set your max size, get your max size, don't be weird with null pointers and zeros unless you mean it. periodt. πŸ’…

ok bye bestie, this was ncurses 6.6, dated 2024-03-16, and that's the whole format(3MENU) moment. πŸ«ΆπŸŒΈπŸ¦‹

πŸ“¦ where this page comes from