|
C-Menu 0.2.9
A User Interface Toolkit
|
Functions for handling field editing and entry. More...
Functions | |
| int | field_editor (Form *form) |
| Accept input for a field. | |
| int | form_display_field_n (Form *form, int n) |
| Display field n. | |
| int | form_display_field (Form *form) |
| Display current field. | |
| int | form_display_field_brackets (Form *form) |
| Display brackets around current field if set. | |
| int | form_fmt_field (Form *form, char *s) |
| Format field according to its format type. | |
| int | form_validate_field (Form *form) |
| Validate current field based on flags. | |
| void | mk_filler (char *s, int fl) |
| Create filler string for field. | |
| void | left_justify (char *s) |
| Left justify string by removing leading spaces. | |
| void | right_justify (char *s, int fl) |
| Right justify string by removing trailing spaces and adding leadingspaces. | |
| bool | is_valid_date (int yyyy, int mm, int dd) |
| Check if a given date is valid, including leap years. | |
| bool | is_valid_time (int hh, int mm, int ss) |
| Check if a given time is valid. | |
| void | numeric (char *d, char *s) |
| Extract numeric characters from source string to destination string. | |
Functions for handling field editing and entry.
This module provides functions for handling field editing and entry within in the C-Menu Form library. It includes functionality for accepting user input for fields, displaying fields, formatting field content based on specified formats, validating field input, and creating filler strings for fields. The module supports various field formats such as strings, decimal integers, hexadecimal integers, floating-point numbers, currency, dates, and times. It also handles user interactions such as navigation keys and mouse events for editing fields. The functions in this module are designed to be used in conjunction with the overall C-Menu Form library to create interactive forms in a text-based user interface.
| int field_editor | ( | Form * | form | ) |
Accept input for a field.
| form | Pointer to Form structure |
KEY_F(10) is the default key for accepting the field and moving to the next field
KEY_F(9) Cancels the current operation
KEY_UP, KEY_BTAB moves to the previous field
KEY_DOWN, TAB moves to the next field
KEY_END moves cursor to end of field
< Enter accepts the field and moves to the next field if form->f_erase_remainder is set, it will clear the remaining characters above and after the current cursor location
KEY_IC toggles insert mode
KEY_DC deletes character at cursor
KEY_HOME moves cursor to start of field
KEY_BACKSPACE deletes character before cursor
KEY_LEFT moves cursor left one character
KEY_RIGHT moves cursor right one character
Handles mouse events for field editing
Validates fields based on format
FF_STRING accepts all printable characters and spaces
FF_DECIMAL_INT accepts digits 0 through 9 and decimal point ('.')
FF_HEX_INT accepts digits 0 through 9 and letters A through F (case-insensitive)
FF_FLOAT accepts digits 0 through 9 and decimal point ('.') and negative operator ('-') at the start of the field
FF_DOUBLE accepts digits 0 through 9 and decimal point ('.') and negative operator ('-') at the start of the field
FF_CURRENCY accepts digits 0 through 9 and decimal point ('.') and negative operator ('-') at the start of the field
FF_YYYYMMDD accepts digits 0 through 9
FF_HHMMSS accepts digits 0 through 9
FF_APR accepts digits 0 through 9 and decimal point ('.')
Definition at line 59 of file fields.c.
References Field::accept_s, Form::chyron, click_x, click_y, Field::col, compile_chyron(), cp_reverse, cp_reverse_highlight, display_chyron(), Form::f_erase_remainder, Field::ff, FF_APR, FF_CURRENCY, FF_DECIMAL_INT, FF_DOUBLE, FF_FLOAT, FF_HEX_INT, FF_HHMMSS, FF_STRING, FF_YYYYMMDD, Form::fidx, Form::field, Field::filler_s, form_display_field(), form_fmt_field(), form_validate_field(), form_yx_to_fidx(), Chyron::l, Field::len, Field::line, Form::lines, Perror(), set_chyron_key_cp(), Form::win, and xwgetch().
Referenced by field_navigator().
| int form_display_field | ( | Form * | form | ) |
Display current field.
| form | Pointer to Form structure |
Definition at line 369 of file fields.c.
References Field::col, Field::display_s, Form::fidx, Form::field, Field::filler_s, form_display_field_brackets(), Field::line, and Form::win.
Referenced by field_editor(), and form_display_field_n().
| int form_display_field_brackets | ( | Form * | form | ) |
Display brackets around current field if set.
| form | Pointer to Form structure |
Definition at line 389 of file fields.c.
References Form::box, Form::brackets, Field::col, Form::fidx, Form::field, Field::len, and Field::line.
Referenced by form_display_field().
| int form_display_field_n | ( | Form * | form, |
| int | n ) |
Display field n.
Definition at line 351 of file fields.c.
References Form::fidx, and form_display_field().
Referenced by form_display_fields().
| int form_fmt_field | ( | Form * | form, |
| char * | s ) |
Format field according to its format type.
| form | Pointer to Form structure |
| s | Input string to format |
Format field according to its format type
| form | Pointer to Form structure |
| s | Input string to format |
Definition at line 421 of file fields.c.
References Field::accept_s, Field::display_s, Field::ff, FF_APR, FF_CURRENCY, FF_DECIMAL_INT, FF_DOUBLE, FF_FLOAT, FF_HEX_INT, FF_HHMMSS, FF_STRING, FF_YYYYMMDD, Form::fidx, Form::field, Field::filler_s, Field::input_s, is_valid_date(), is_valid_time(), left_justify(), Field::len, mk_filler(), numeric(), Perror(), right_justify(), strnz(), strnz__cpy(), and trim().
Referenced by field_editor(), and form_read_data().
| int form_validate_field | ( | Form * | form | ) |
Validate current field based on flags.
| form | Pointer to Form structure |
Definition at line 588 of file fields.c.
References Field::accept_s, Field::ff, Form::fidx, Form::field, and Perror().
Referenced by field_editor().
| bool is_valid_date | ( | int | yyyy, |
| int | mm, | ||
| int | dd ) |
Check if a given date is valid, including leap years.
| yyyy | Year |
| mm | Month |
| dd | Day |
Definition at line 672 of file fields.c.
Referenced by form_fmt_field().
| bool is_valid_time | ( | int | hh, |
| int | mm, | ||
| int | ss ) |
Check if a given time is valid.
| hh | Hour |
| mm | Minute |
| ss | Second |
Definition at line 693 of file fields.c.
Referenced by form_fmt_field().
| void left_justify | ( | char * | s | ) |
Left justify string by removing leading spaces.
| s | String to left justify |
Definition at line 634 of file fields.c.
References trim().
Referenced by form_fmt_field().
| void mk_filler | ( | char * | s, |
| int | fl ) |
Create filler string for field.
| s | Filler string to create |
| fl | Field length |
Definition at line 617 of file fields.c.
References Form::fill_char, and form.
Referenced by form_fmt_field().
| void numeric | ( | char * | d, |
| char * | s ) |
Extract numeric characters from source string to destination string.
| d | Destination string |
| s | Source string |
Definition at line 709 of file fields.c.
Referenced by form_fmt_field().
| void right_justify | ( | char * | s, |
| int | fl ) |
Right justify string by removing trailing spaces and adding leadingspaces.
Definition at line 646 of file fields.c.
References trim().
Referenced by form_fmt_field().