INPUTFIELD |
![]() ![]() ![]() |
The INPUTFIELD statement enables entry of data from the keyboard at a specific screen position or from previously stored DATA statements. It differs from INPUT @ in that it terminates on entry of any control character not recognised as an editing key. This allows application software to capture and handle control and function keys.
Format
INPUTFIELD @(x, y) {,} {:} var, length {_} {:} {format} {modes} {THEN statement(s)} {ELSE statement(s)}
where
The comma after the cursor position is optional and has no effect on the operation of the statement.
The optional THEN and ELSE clauses used with TIMEOUT allow a program to determine whether the input timed out. Successful input executes the THEN clause. A timeout will execute the ELSE clause.
The INPUTFIELD statement reads data from the DATA queue or, if there is no stored data, from the keyboard.
The INPUTFIELD statement works similarly to the INPUT @ statement except that entry of any control character not recognised as an editing function (see INPUT @) terminates data entry. The STATUS() function can be used to determine the key that caused exit. This will return zero for the return key and the internal key code for any other key.
When the return key is pressed to terminate input, if a format is specified, the data is redisplayed using this mask to apply format rules such as right justification.
Keyboard Input
When reading from the keyboard, the current prompt character will be displayed to the left of the given input position. No prompt is displayed if the input column position, x, is zero or if the prompt has been disabled using the PROMPT statement. The prompt character will be removed from the screen on completion of the input.
If the colon character before var is present, the original contents or var are displayed in the input area and entry commences in overlay mode. If the colon character before var is not present, entry commences in insert mode with a blank field.
The user has three options:
The values stored for printing characters are the ASCII characters associated with the key. Non-printing characters result in stored character values as listed under Character Values for Terminal Input.
If no length expression is included, data characters are stored until the return key is pressed.
If length is specified, up to that number of characters may be entered after which input is automatically terminated as though the return key had been pressed, any subsequent key entries being retained for the next INPUT statement. The return key is not stored as part of the input data.
The INPUTFIELD statement may not behave correctly if the length of the input field causes it to extend over multiple lines and the terminal in use does not automatically wrap from one line to the next when displaying long text output.
The optional underscore component of the statement suppresses the automatic input termination when length characters have been entered. Any number of characters may be entered but only length characters will be displayed.
The optional colon causes the carriage return and line feed output when the return key is used or on reaching the input length limit to be suppressed.
DATA Queue Input
Where the data queue is not empty, the INPUT @ statement reads the item at the head of this queue, copying it verbatim to var with no processing of any embedded control characters. The length expression is ignored. The item is displayed as though it had been typed.
See also: |