|
Purpose |
data input functions for dialogs |
|
|
Syntax |
int inpm_b(short *flags, unsigned bit) inpm_i()may be implmented as a macro. It is only required for variables you declare yourself as int. |
|
|
Parameters |
data |
Pointer to variable holding data to display and input |
|
|
short* flags |
Pointer to flag containing the bit to be edited |
|
|
unsigned bit |
The bit in the flags parameter that the user is being asked to enter |
|
|
Note that inpm_h(), and not inpm_i(), should be
used for input of type I fields. A good C compiler will flag it as
an error if you inadvertently use inpm_i() on a DP4 type I field.
Unfortunately some compilers, including Microsoft C, only flag this
as a warning, (at least for C programs), even though it causes a
memory corruption. |
|
|
Description |
The inpm_x() functions are the preferred functions for data entry, replacing the older scrnx_map() functions. inpm_x() functions are typically used with the map_get_inputs() function to create data entry functions. The global variables input_map and input_field are used to control the current map and field numbers. These global variables have to be set up with a call to the function map_use(), before calling the inpm_x() functions. The map_get_inputs() function does this automatically for you. Using these global variables reduces code size (of both source and executables). The inpm_x() functions are implemented by calls to the general inpm() function, using the global variable scrn_flags as the flags parameter, (inpm_d() used scrnd_flags). To edit multi-occurs fields, the general inpm() function must usually be used,but you can use inpm_c(),inpm_s() and inpm_u() with multi-occurs fields. If the global variable realpass is FALSE inpm_x() functions just display the data, increment the field number to the next field and return a non zero value. If realpass is TRUE they work as follows: On entry the field is cleared (meaning that the data is set to the default on the database, or a zero or blank value if the field is not a database field) under the following conditions:
Input is then solicited from the user unless jump is TRUE. inpm_x() returns when the user moves away from the field, (or the maximum number of character have been entered and the auto-enter property is set in scrn_flags or in the properties for the field). On return from these functions, *input_field is set to the next field number to be processed. A field number of 0 means that the user has completed the dialog. If the user moves to another field with the mouse or cursor keys input_field is adjusted in such a way as to ensure any fields that would be missed out if fieldnr was set directly to the target field are validated. This is explained in detail in Field Navigation During Data Entry. If the user completes the field normally abort_code and the return value is set to 0,indicating the field should be validated. If the user presses the <Esc> key, the global variable abort_code is set to the value ESCAPE (and *input_field is set to the first field in the map). If the user leaves a field with a cursor movement key, or by clicking on another field with the mouse, or requests prompt, abort_code is set accordingly as listed below: |
|
|
|
Value |
User action |
|
|
UP_LINE |
User navigated with the <↑> key |
|
|
To use the prompt facility, add the value PROMPT_AVAILABLE to the global variable scrn_flags before calling inpm_x() functions. To determine whether prompt was requested, test that the return value is zero and that the global variable abort_code contains the value SPACE_BAR. |
|
|
Return values |
Returns a non zero value (usually the value of the global variable abort_code ) if the program should break (not validate the field), or zero if the data was entered normally and should be validated. |
|
|
See also |
map_use(), map_get_inputs(), inpm_xnp(), inpm(), inpm_omit(), scrnx_map() |
|
|
Remarks |
inpm_c() allows you to enter mix cased data, whereas inpm_u() converts all keystrokes to uppercase, inpm_s() like inpm_u() but converts spaces to underscore characters and only allows characters that are permitted in identifiers (and @). Usually each function is used with the corresponding DP4 datatype, but this is not manadatory. inpm_b() is used to edit one bit in a short to be edited. For example, the call: inpm_b(&device, PRINTER);
is used in the function dvc_choose() to toggle the PRINTER bit in the devive_flags parameter. inpm_b() allows a single I field to be used to store the equiavlent of 16 Y fields. |
|
|
Example |
See the map_get_inputs() example |
|