form_page(3X)

πŸ’– form_page(3X) β€” the one where we set & get form page numbers πŸ’–

okay bestie, sit down, hydrate, and let's talk about form_page(3X). this one's a Library calls girlie from the ncurses 6.6 era, and she's literally all about pages, fields, and focus. no cap, it's giving "underrated". let's go πŸ¦‹


✨ NAME ✨

form_page β€” set and get form page number 🌸


πŸŽ€ SYNOPSIS πŸŽ€

#include <form.h>

int set_current_field(FORM *form, FIELD *field);
FIELD *current_field(const FORM *form);

int unfocus_current_field(FORM *form);

int set_form_page(FORM *form, int n);
int form_page(const FORM *form);

int field_index(const FIELD *field);

πŸ‘‘ DESCRIPTION πŸ‘‘

okay so, first up: set_current_field sets the current field of the given form, and current_field hands you back the current field of the given form. matching set, they're a duo, they ate πŸ’…

then there's unfocus_current_field, which removes the focus from the current field of the form. and listen β€” while you're in that state, any inquiry via current_field shall return a NULL pointer. she's empty on purpose, it's a vibe πŸ™ˆ

set_form_page sets the form's page number, aka it goes to page n of the form. yes, page n. very demure, very mindful πŸ“–

form_page returns the form's current page number. that's the whole job and she does it flawlessly ⭐

last but never least, field_index returns the index of the field in the field array of the form it is connected to. but heads up bestie: it returns ERR if the argument is the null pointer, or if the field is not connected. so like… plug in your field first πŸ”Œ


🌈 RETURN VALUE 🌈

except for form_page, each routine returns one of the following:

  • E_OK β€” the routine succeeded. slay, no notes, we love a happy ending ✨
  • E_BAD_ARGUMENT β€” routine detected an incorrect or out-of-range argument. you gave her something she cannot work with 😭
  • E_BAD_STATE β€” routine was called from an initialization or termination function. wrong place, wrong time, read the room πŸ’€
  • E_INVALID_FIELD β€” contents of a field are not valid. the field is going through something πŸ“
  • E_REQUEST_DENIED β€” the form driver could not process the request. she said no 🫢
  • E_SYSTEM_ERROR β€” system error occurred (see errno(3)). not her fault, blame the system πŸ”₯

🧚 PORTABILITY 🧚

these routines emulate the System V forms library. they were not supported on Version 7 or BSD versions β€” so if you're on ancient territory, that's a no from her 🌸

and important: the unfocus_current_field function is an ncurses extension. so it's her special little extra, iykyk πŸ’œ


πŸ’– AUTHORS πŸ’–

Juergen Pfeifer. Manual pages and adaptation for new curses by Eric S. Raymond. absolute icons, we thank them for their service πŸ‘‘


πŸ”₯ SEE ALSO πŸ”₯

  • curses(3X)
  • form(3X)

okay that's the whole page, you're officially a form_page(3X) expert now, go forth and set those page numbers bestie πŸ’…βœ¨

this has been ncurses 6.6, dated 2024-12-28, signing off from the form_page(3X) page β€” mwah, bye πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from