form(3X)
π form(3X) β the form library π
okay so this is the form(3X) page from the Library calls section, and it's literally your whole guide to making user-fillable forms in curses windows. bestie, it's giving terminal UI main character energy π
β¨ NAME β¨
form β present user-fillable forms in curses windows π
πΈ SYNOPSIS πΈ
#include <form.h>
π¦ DESCRIPTION π¦
The form library gives you terminal-independent facilities for composing form screens on character-cell terminals. no cap, it's the whole vibe.
The library includes:
- field routines, which create and modify form fields
- form routines, which group fields into forms, display forms on the screen, and handle interaction with the user
The form library uses the curses libraries. To use the form library, link with the options -lform -lcurses. periodt.
Your program should set up the locale, e.g.:
setlocale(LC_ALL, "");
so that input/output processing will work. π
A curses initialization routine such as initscr must be called before using any of these functions.
β¨ Current Default Values for Field Attributes β¨
The form library maintains a default value for field attributes. You can get or set this default by calling the appropriate set_ or retrieval routine with a NULL field pointer. π«Ά
Changing this default with a set_ function affects future field creations, but does not change the rendering of fields already created.
π Routine Name Index π
The following table lists each form routine and the name of the manual page on which it is described. Routines flagged with β*β are ncurses-specific, not present in SVr4. π
current_fieldβform_page(3X)data_aheadβform_data(3X)data_behindβform_data(3X)dup_fieldβform_field_new(3X)dynamic_field_infoβform_field_info(3X)field_argβform_field_validation(3X)field_backβform_field_attributes(3X)field_bufferβform_field_buffer(3X)field_countβform_field(3X)field_foreβform_field_attributes(3X)field_indexβform_page(3X)field_infoβform_field_info(3X)field_initβform_hook(3X)field_justβform_field_just(3X)field_optsβform_field_opts(3X)field_opts_offβform_field_opts(3X)field_opts_onβform_field_opts(3X)field_padβform_field_attributes(3X)field_statusβform_field_buffer(3X)field_termβform_hook(3X)field_typeβform_field_validation(3X)field_userptrβform_field_userptr(3X)form_driverβform_driver(3X)form_driver_wβform_driver(3X)*form_fieldsβform_field(3X)form_initβform_hook(3X)form_optsβform_opts(3X)form_opts_offβform_opts(3X)form_opts_onβform_opts(3X)form_pageβform_page(3X)form_request_by_nameβform_requestname(3X)*form_request_nameβform_requestname(3X)*form_subβform_win(3X)form_termβform_hook(3X)form_userptrβform_userptr(3X)form_winβform_win(3X)free_fieldβform_field_new(3X)free_fieldtypeβform_fieldtype(3X)free_formβform_new(3X)link_fieldβform_field_new(3X)link_fieldtypeβform_fieldtype(3X)move_fieldβform_field(3X)new_fieldβform_field_new(3X)new_fieldtypeβform_fieldtype(3X)new_formβform_new(3X)new_pageβform_new_page(3X)pos_form_cursorβform_cursor(3X)post_formβform_post(3X)scale_formβform_win(3X)set_current_fieldβform_page(3X)set_field_backβform_field_attributes(3X)set_field_bufferβform_field_buffer(3X)set_field_foreβform_field_attributes(3X)set_field_initβform_hook(3X)set_field_justβform_field_just(3X)set_field_optsβform_field_opts(3X)set_field_padβform_field_attributes(3X)set_field_statusβform_field_buffer(3X)set_field_termβform_hook(3X)set_field_typeβform_field_validation(3X)set_field_userptrβform_field_userptr(3X)set_fieldtype_argβform_fieldtype(3X)set_fieldtype_choiceβform_fieldtype(3X)set_form_fieldsβform_field(3X)set_form_initβform_hook(3X)set_form_optsβform_field_opts(3X)set_form_pageβform_page(3X)set_form_subβform_win(3X)set_form_termβform_hook(3X)set_form_userptrβform_userptr(3X)set_form_winβform_win(3X)set_max_fieldβform_field_buffer(3X)set_new_pageβform_new_page(3X)unfocus_current_fieldβform_page(3X)*unpost_formβform_post(3X)
π RETURN VALUE π
Routines that return pointers return NULL on error, and set errno to the corresponding error-code returned by functions returning an integer. iykyk.
Routines that return an integer return one of the following error codes:
E_OKβ the routine succeeded. slay.E_BAD_ARGUMENTβ routine detected an incorrect or out-of-range argument.E_BAD_STATEβ routine was called from an initialization or termination function.E_CONNECTEDβ the field is already connected to a form.E_INVALID_FIELDβ contents of a field are not valid.E_NOT_CONNECTEDβ no fields are connected to the form.E_NOT_POSTEDβ the form has not been posted.E_NO_ROOMβ form is too large for its window.E_POSTEDβ the form is already posted.E_REQUEST_DENIEDβ the form driver could not process the request.E_SYSTEM_ERRORβ system error occurred (seeerrno(3)).E_UNKNOWN_COMMANDβ the form driver code saw an unknown request code.
π NOTES π
The header file form.h itself includes curses.h. lowkey convenient.
π PORTABILITY π
These routines emulate the System V forms library. They were not supported on Version 7 or BSD versions.
A form facility was documented in SVr4.2's Character User Interface Programming document.
It is not part of X/Open Curses.
Aside from ncurses, there are few implementations:
- systems based on SVr4 source code, e.g., Solaris.
- NetBSD curses.
A few functions in this implementation are extensions added for ncurses, but not provided by other implementations, e.g., form_driver_w, unfocus_current_field.
π AUTHORS π
Juergen Pfeifer. Manual pages and adaptation for ncurses by Eric S. Raymond. iconic, honestly.
π SEE ALSO π
curses(3X) and related pages whose names begin βform_β for detailed descriptions of the entry points.
xoxo bestie π this was the form(3X) page from ncurses 6.5, dated 2025-11-11. periodt. π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright 2018-2024,2025 Thomas E. Dickey
- Copyright 1998-2016,2017 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