form_field_opts(3X)

πŸ’– form_field_opts β€” the field options manual, bestie edition πŸ’–

okay so this is form_field_opts(3X), a library-calls page from the curses/forms world, and it's literally all about flipping a field's option bits on and off. group chat, gather round 🫢


✨ NAME ✨

set_field_opts, field_opts_on, field_opts_off, field_opts β€” bestie, these are the functions that set and get field options. that's the whole vibe.


🌸 SYNOPSIS 🌸

#include <form.h>

int set_field_opts(FIELD *field, Field_Options opts);
Field_Options field_opts(const FIELD *field);

int field_opts_on(FIELD *field, Field_Options opts);
int field_opts_off(FIELD *field, Field_Options opts);

no cap, that's the whole signature situation ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so let's break these four down, because they are not the same function and i need you to know that πŸ’…

  • set_field_opts β€” sets all the given field's option bits. and yes, field option bits may be logically "or"-ed together. so you can stack them. obsessed.
  • field_opts_on β€” turns on the given option bits, and leaves others alone. it's giving "respectful, doesn't touch what isn't hers" πŸ‘‘
  • field_opts_off β€” turns off the given option bits, and leaves others alone. same energy, opposite direction.
  • field_opts β€” returns the field's current option bits. the little reporter. the gossip. πŸŽ€

🌈 the standard options

these are defined, and heads up β€” all of them are on by default. slay.

  • O_ACTIVE β€” the field is visited during processing. if this option is off, the field will not be reachable by navigation keys. also, please notice that an invisible field appears to be inactive also. yes, both things. both are true. πŸ’€
  • O_AUTOSKIP β€” skip to the next field when this one fills. it's the "okay you're done, next" of options.
  • O_BLANK β€” the field is cleared whenever a character is entered at the first position. fresh start energy.
  • O_EDIT β€” the field can be edited. that's it. that's the option.
  • O_NULLOK β€” allow a blank field. let her be empty, she's allowed πŸ•ŠοΈ
  • O_PASSOK β€” validate field only if modified by user.
  • O_PUBLIC β€” the field contents are displayed as data is entered. live, unfiltered, no drafts.
  • O_STATIC β€” field buffers are fixed to field's original size. turn this option off to create a dynamic field. so like, static vs dynamic is literally this one bit. iconic.
  • O_VISIBLE β€” the field is displayed. if this option is off, display of the field is suppressed. she's in her private era πŸ™ˆ
  • O_WRAP β€” words that do not fit on a line are wrapped to the next line. words are blank-separated. important detail, don't forget it.

πŸ’œ the extension options

these are defined too, but bestie β€” extensions are off by default. opposite situation from the standard ones. keep up ✨

  • O_DYNAMIC_JUSTIFY β€” permit dynamic fields to be justified, like static fields.
  • O_NO_LEFT_STRIP β€” preserve leading whitespace in the field buffer, which is normally discarded. so by default that whitespace gets yeeted, and this option says "no, keep it" 😀
  • O_EDGE_INSERT_STAY β€” when inserting into a field up to the boundary position, optionally delay the scrolling, so that the last inserted character remains visible, but advance the cursor to reflect the insertion. this allows the form library to display the inserted character in one-character fields as well as allowing the library to maintain consistent state. it's giving "i can do both, actually" πŸ’…
  • O_INPUT_FIELD β€” the set_max_field function checks for this extension, which allows a dynamic field to shrink if the new limit is smaller than the current field size. shrinking is allowed here, and that's on periodt.

⭐ RETURN VALUE ⭐

okay so except for field_opts, each routine returns one of the following:

  • E_OK β€” the routine succeeded. we love a win πŸŽ‰
  • E_BAD_ARGUMENT β€” routine detected an incorrect or out-of-range argument. she said "absolutely not."
  • E_CURRENT β€” the field is the current field.
  • E_SYSTEM_ERROR β€” system error occurred (see errno(3)).

🧚 PORTABILITY 🧚

these routines emulate the System V forms library. they were not supported on Version 7 or BSD versions. so if you're kicking it on those, no dice, bestie 😭


πŸ‘‘ AUTHORS πŸ‘‘

Juergen Pfeifer. manual pages and adaptation for new curses by Eric S. Raymond. legends, honestly. we stan. 🫢


🌈 SEE ALSO 🌈

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

and that's the page!! this was ncurses 6.6, dated 2025-01-18, filed under form_field_opts(3X) β€” go forth and configure your fields, you absolute main character πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…

πŸ“¦ where this page comes from