You won't be long into computing in any computer language until you realise that you need some good stable routines for accepting into your programs data typed at the keyboard. The standard Euphoria input routines such as gets() just do not provide the sort of control that you need to oblige the computer user to type in the appropriate sort of data and to avoid messing up the computer screen.
The header (include) file facptnew.e contains the following global functions which accept typed data into fields specified by yourself:
- accept() -- A function which accepts keyed data in these forms:
- As general alpha-numeric input, including most punctuation marks;
- Integer numeric input of any (reasonable) length;
- Decimal numeric input of any (reasonable) length.
- accept_formatted() -- A function which accepts numeric input using templates (which you can modify to suit yourself).
Also included in the file are four global functions which use these routines to let you view, enter and modify record data using a simple screen form:
- display_screen_form() -- which displays your record data in a form on the screen.
- display_empty_screen_form() -- displays an empty screen form on screen.
- edit_record() -- for editing the data in an existing record.
- typein_new_record() -- used to type in the data for a brand new record.
These form routines are accessed using a sequence which in the demo program I have named meta_data (which means data about data).
Full editing (use of insert, backspace, delete keys) is provided for fields of all types except formatted numeric fields where only backspace is supported.
Abundant comment notes in the files will tell you all you want to know about the routines, how to interact with them and how to modify them to suit your own requirements, so I won't go on any more about them here.
© Fred Mangan 2006