input
Returns user input from screen field with validation.
Available in:
Apps (win) |
Apps (char) |
Reportwriter |
RPC |
Standalone PL |
X |
X |
|
|
|
Syntax
void input([variable][[,newvalue,key]])
ident variable
expr newvalue
int key
Description
Validates the data entered into the currently active field
based on the field type and attributes. If the data is valid, it is placed
in the field variable.
If the input field resides on a page that isn't the active page, the active
page is changed.
If variable is not supplied, the application waits for an active
key to be pressed.
If newvalue and key are supplied, input does not wait but
emulates the user entering newvalue into the current field and
pressing key.
variable | (optional) contains data that has been input and
validated. It must be char/string and at least as large as the field.
|
newvalue | (optional) contains data that will be
entered into the current field as though the user had typed it.
|
key | (optional) the key index to emulate.
|
Notes
The alarm setting, busy_alarm, in trim/dv.ini helps you
control a runaway query or looping function. For complete information, refer to
trim/dv.ini documentation in the DesignVision Users Guide or
Trifox Resource Manual.
Can only be used when in a field. An input(variable) call causes the following sequence of events:
- G.MODIFIED is set to false.
- Waits for user input; G.KEY holds the input-terminating key. If the user
enters anything, G.INPUT_DATA is set to true.
- any_key trigger is executed (if it exists).
- raw_input data moves from temporary storage to variable.
- G.INPUT_DONE is set to true.
- If there is a pre-validation key trigger, execute key trigger (parm[0] is variable).
- If G.INPUT_DONE is false, goes to step 1.
- Validates NULL, TYPE, and MASK. Goes to step 1 whenever validation fails.
- Converts and moves the data in variable to temporary storage (parm[0] in validate trigger).
- If there is a foreign key trigger:
- Executes foreign key trigger.
- Goes to step 1 on failure (error() is invoked).
- If G.INPUT_DONE is false, goes to step 1.
- If there is a validate trigger:
- Executes validate trigger.
- Goes to step 1 on failure (error() is invoked).
- If G.INPUT_DONE is false, goes to step 1.
- If G.MODIFIED is false, moves converted data from temporary storage to field variable. Set G.MODIFIED to true.
- If there is a post-validation trigger, executes key trigger (parm[0] is variable).
- If G.INPUT_DONE is false, goes to step 1.
- Returns to caller.
Example
If get_data is true, then wait for input and do validation; otherwise, simply
wait for an event trigger (function key or mouse event).
if (get_data) input(input_var);
else input();