C-Menu 0.2.9
A User Interface Toolkit
Loading...
Searching...
No Matches
fields.c File Reference

Field Edit and Entry for C-Menu Form. More...

#include <common.h>
#include <monetary.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
Include dependency graph for fields.c:

Go to the source code of this file.

Functions

void display_field (Form *form, cchar_t *cmplx_buf, int y, int x)
int field_editor (Form *form)
 Accept input for a field.
int form_display_accept_field (Form *)
int form_display_field (Form *form)
 Display current field.
int form_display_field_n (Form *form, int n)
 Display field n.
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.
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 left_justify (char *s)
 Left justify string by removing leading spaces.
void numeric (char *d, char *s)
 Extract numeric characters from source string to destination string.
void right_justify (char *, int)
 Right justify string by removing trailing spaces and adding leadingspaces.

Variables

char ff_tbl [][26]

Detailed Description

Field Edit and Entry for C-Menu Form.

Author
Bill Waller Copyright (c) 2025 MIT License billx.nosp@m.wall.nosp@m.er@gm.nosp@m.ail..nosp@m.com
Date
2026-02-09

Definition in file fields.c.

Function Documentation

◆ display_field()

void display_field ( Form * form,
cchar_t * cmplx_buf,
int y,
int x )

Definition at line 369 of file fields.c.

369 {
370
371 mvwadd_wchstr(form->win, y, x, cmplx_buf);
372}
Form * form
Definition mem.c:48

References Form::win.

◆ form_display_accept_field()

int form_display_accept_field ( Form * form)

Definition at line 393 of file fields.c.

393 {
394 int y = form->field[form->fidx]->line;
395 int x = form->field[form->fidx]->col;
396 mvwaddstr(form->win, y, x, form->field[form->fidx]->filler_s);
397 mvwaddstr(form->win, y, x, form->field[form->fidx]->accept_s);
398 return 0;
399}

References Field::accept_s, Field::col, Form::fidx, Form::field, Field::filler_s, Field::line, and Form::win.

Referenced by field_editor().

Here is the caller graph for this function:

Variable Documentation

◆ ff_tbl

char ff_tbl[][26]
Initial value:
= {"string", "decimal_int", "hex_int", "float", "double",
"currency", "yyyymmdd", "hhmmss", "apr", ""}

ff_tbl - a table of field format strings used in the Form description file to identify field data types the index of the field format in this table corresponds to the FieldFormat enum values, e.g. ff_tbl[FF_STRING] = "string", ff_tbl[F_DECIMAL_INT] = "decimal_int", etc. a table of field format strings used in the Form description file to identify field data types, e.g. "string", "decimal_int", "hex_int", etc. The index of the field format in this table corresponds to the FieldFormat enum values, e.g. ff_tbl[FF_STRING] = "string", ff_tbl[FF_DECIMAL_INT] = "decimal_int", etc. This table is used for parsing the form description file and determining the field formats for each field in the form.

Definition at line 26 of file fields.c.

26 {"string", "decimal_int", "hex_int", "float", "double",
27 "currency", "yyyymmdd", "hhmmss", "apr", ""};

Referenced by form_parse_desc().