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:

  1. G.MODIFIED is set to false.
  2. Waits for user input; G.KEY holds the input-terminating key. If the user enters anything, G.INPUT_DATA is set to true.
  3. any_key trigger is executed (if it exists).
  4. raw_input data moves from temporary storage to variable.
  5. G.INPUT_DONE is set to true.
  6. If there is a pre-validation key trigger, execute key trigger (parm[0] is variable).
  7. If G.INPUT_DONE is false, goes to step 1.
  8. Validates NULL, TYPE, and MASK. Goes to step 1 whenever validation fails.
  9. Converts and moves the data in variable to temporary storage (parm[0] in validate trigger).
  10. If there is a foreign key trigger:
  11. If there is a validate trigger:
  12. If G.MODIFIED is false, moves converted data from temporary storage to field variable. Set G.MODIFIED to true.
  13. If there is a post-validation trigger, executes key trigger (parm[0] is variable).
  14. If G.INPUT_DONE is false, goes to step 1.
  15. 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();