menu_format(3X)
π menu_format(3X) β the set_menu_format / menu_format glow-up guide β¨
okay bestie, so this is a library call page from ncurses β it's the one that tells a MENU how big it's allowed to be on screen, and also lets you ask a menu how big it thinks it is. two functions, one page, both iconic in their own way π
πΈ NAME πΈ
set_menu_format, menu_format β set and get menu sizes, fr fr. one sets, one gets, that's the whole vibe check.
β¨ 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, yes, that's the whole thing. go off π
π¦ DESCRIPTION π¦
so set_menu_format sets the maximum display size of the given menu. that's the ceiling, the limit, the "you may not pass" line for how much screen real estate this menu gets. π§
and here's the tea β if that size is too small to display all the menu items, the menu will be made scrollable. so it's not broken, bestie, it just scrolls. you're welcome. π
but reverse that vibe and it gets spicy: if the size is larger than the menu's subwindow and the subwindow is too small to display all menu items, post_menu will fail. like. it just won't post. no cap, that's a real trap, watch out for it π
π¨ the default format is16rows,1column. write that down.
calling set_menu_format with a null menu pointer will change this default. yes, the global default, not one menu's. slippery slope, iykyk π«Ά
also β a zero row or column argument to set_menu_format is interpreted as a request not to change the current value. so passing 0 is basically you saying "nah leave that one alone, i'm only here for the other one." lowkey efficient β¨
then there's menu_format, which returns the maximum-size constraints for the given menu into the storage addressed by rows and cols. you hand it pointers, it fills them in. main character energy of a function that just delivers π
π RETURN VALUE π
so these routines return one of the following β yes, menu_format returns void and set_menu_format returns an int, but the error codes below are the whole zoo. buckle up π
E_OKβ the routine succeeded. slay. that's it, that's the good one πE_SYSTEM_ERRORβ a system error occurred (seeerrno(3)). not your fault, the system is having a moment πE_BAD_ARGUMENTβ the routine detected an incorrect or out-of-range argument. you gave it something unhinged, bestie πE_POSTEDβ the menu is already posted. it's out there, living its life, you can't touch it rn πE_NOT_CONNECTEDβ no items are connected to the menu. it's giving empty group chat. ghost town. π«₯
π§ PORTABILITY π§
these routines emulate the System V menu library. so they're cosplaying the classics, respectfully π
they were not supported on Version 7 or BSD versions. nope, not invited to that party πΈ
π AUTHORS π
Juergen Pfeifer. and manual pages plus adaptation for new curses by Eric S. Raymond. absolute legends, both of them, we stan π«Ά
π SEE ALSO π
curses(3X)menu(3X)
and that's the page, bestie!! this lovely thing lives in ncurses 6.5, dated 2024-03-16, and it's filed under menu_format(3X) in the Library calls section. go format a menu, you got this π
β¨ππ
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright 2018-2023,2024 Thomas E. Dickey
- Copyright 1998-2015,2016 Free Software Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms