field(3FORM)

πŸ’… field(3FORM) β€” Library calls πŸ’…

okay bestie, we're doing form_field today and honestly? it's the friendship-manager of curses. it makes and breaks the connections between fields and forms. matchmaker era 🫢


✨ NAME ✨

form_field β€” make and break connections between fields and forms πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

#include <form.h>

int set_form_fields(FORM *form, FIELD **fields);
FIELD **form_fields(const FORM *form);
int field_count(const FORM *form);
int move_field(FIELD *field, int frow, int fcol);

🌸 DESCRIPTION 🌸

so like, four little functions, four little jobs. here's the tea β˜•

  • set_form_fields changes the field pointer array of the given form. and babes, the array must be terminated by a NULL β€” no cap, that's the rule. πŸ™ˆ
  • form_fields returns the field array of the given form. it's giving "here's your roster, bestie" πŸ“‹
  • field_count returns the count of fields in form. math but make it cute ✨
  • move_field moves the given field to a specified location on the screen. but listen β€” that field must be disconnected first, okay? it's not available, it's not on the market, it's single and ready to mingle at a new spot πŸ’…

πŸ”₯ RETURN VALUE πŸ”₯

  • form_fields returns a pointer (which may be NULL πŸ‘€). it does not set errno.
  • field_count returns ERR if the form parameter is NULL. rude but true 😭
  • set_form_fields and move_field return one of the following codes on error:
  • E_OK β€” the routine succeeded. slay, we ate πŸ“
  • E_BAD_ARGUMENT β€” routine detected an incorrect or out-of-range argument. it's giving "bestie what is that number" πŸ’€
  • E_CONNECTED β€” the field is already connected to a form. taken. unavailable. blocked. 🚫
  • E_POSTED β€” the form is already posted. it's busy being the main character rn πŸ‘‘
  • E_SYSTEM_ERROR β€” system error occurred (see errno(3)). not our 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 time-traveling, lowkey watch out πŸ•°οΈ

also: the SVr4 forms library documentation specifies the field_count error value as -1 (which is the value of ERR). so same energy, different font ✨


πŸ‘‘ AUTHORS πŸ‘‘

Juergen Pfeifer. Manual pages and adaptation for new curses by Eric S. Raymond. icons, both of them πŸ’œ


πŸ¦‹ SEE ALSO πŸ¦‹

ncurses(3NCURSES), form(3FORM)


okay that's the whole vibe check, bestie β€” go forth and connect those fields responsibly πŸ§šπŸ’–

this has been ncurses 6.6, dated 2024-12-28, signing off like the icon it is ⭐

πŸ“¦ where this page comes from