|
Purpose |
Field input functions |
|
|
Old name |
#define scrnx_field askf_x |
|
|
Syntax |
int askf_c(mapnr, fieldnr, data) |
|
|
Parameters |
int mapnr |
Number of map containing the field |
|
|
int fieldnr |
Number of field to input data from |
|
|
<type> data |
Variable or pointer to variable in which to place input data |
|
|
The <type> of the parameter data depends on which askf_x() function is used, as shown below. Also shown is the corresponding DP4 datatype for each of the askf_x() functions: |
|
| Function | Type | DP4 datatype |
|---|---|---|
|
askf_c |
char* |
C |
|
askf_d |
datetype* |
D |
|
askf_h |
short* |
I |
|
askf_i |
int* |
I |
|
askf_l |
long* |
L |
|
askf_n |
double* |
N |
|
askf_s |
char* |
S |
|
askf_t |
timetype* |
T |
|
askf_u |
char* |
U |
|
askf_y |
boolean * |
Y |
|
Description |
These functions are the screen input functions. The data is accepted from the screen in the position of the specified field. These functions are generally used when there is only one field in the map, or the input sequence is fixed and previous input values cannot be corrected. If the user is allowed to cursor through the fields the scrnx_map() or inpm_x() functions should be used. The detailed action of the askf_x() functions depends on the global variables clearfirst and jump. The global variable clearfirst controls whether the field should appear as it does before any input, or set to the default value. The global variable jump gives you a mechanism for skipping the remaining fields in a sequence. The global variables clearfirst and jump are most commonly used as follows:
If the value entered by the user differs from the previous value, the global variable changed is set to TRUE. If the user presses <Tab> without altering the data, the global variable jump is set to TRUE, otherwise its value is not changed. If the user presses <Esc>, the global variable abort_code is set to ESCAPE, otherwise it is set to zero. The format in which the data is displayed is controlled by the global variables scrn_flags and scrnd_flags, which are initialised to the value DEFAULT. The global variables scrn_flags and scrnd_flags may take the same values as the global variables show_flags and showd_flags, as described for the show_x() functions, with the following differences: |
||
|
|
Value |
Meaning |
|
|
|
SKIP_MISSING_FIELD |
If the field does not exist then the program does not crash. A value of zero is returned |
|
|
|
FUNC_KEYS |
Allows the user to press one of the function keys, which will return with the global variable abort_code set to a non-zero value. In some configurations, 9 and 10 will be used for help and training mode keys and will not return a value |
|
|
|
CURS_KEY |
Changes the action of the <Ins>, <Del>, <Pg Up> and <Pg Dn> cursor keys. Instead of editing, they cause the function to return with the global variable abort_code set to a non-zero value |
|
|
|
NULL_FORBIDDEN |
Prevents the input of a null value |
|
|
|
END_WITHOUT_CR |
Causes input to terminate when the field is full, without the user having to press <Enter> |
|
|
|
OVERTYPE_MODE |
Prevents the function askf_c() destroying the existing contents of field as soon as the user presses a key |
|
|
|
If the global variables scrn_flags and scrnd_flags are set to the value DEFAULT, a call to an askf_x() function will use the format flags that were set with MAPEDIT or MAPPOST. If the global variable abort_code is set to a non-zero value on return, its numeric value can be used to determine which key was pressed. The possible values are: |
||
|
|
Value |
If the user pressed |
|
|
|
ESCAPE |
the <Esc> key |
|
|
|
To input into multi-occurs fields, use the general askf() function, unless it is a character field when you can use the askf_c function. |
||
|
Return values |
Returns the value of the global variable abort_code |
||
|
See also |
|||
|
Example |
|
||