Understanding the PROMPT instruction
The PROMPT
instruction is used to query for a single value from the
user.
PROMPT
requires the text of the question to be
displayed to the user and the variable that receives the value entered
by the user. The variable can be of any simple data type except
TEXT
and BYTE
.
The runtime system displays the question in the prompt area, waits for the user to enter a value, reads whatever value was entered until the user validates (for example with the Enter key), and stores this value in a response variable. The prompt dialog remains visible until the user enters a response.
The prompt finishes after ON IDLE
, ON ACTION
, or
ON KEY
block execution (to ensure backwards compatibility).
Prompt display in TUI mode
In TUI mode, the PROMPT
question and input field is displayed in the prompt line
of the current window, which is defined by the OPTIONS PROMPT LINE
instruction or
with the ATTRIBUTES
clause of OPEN WINDOW
. If the prompt line is
not as wide as the prompt string, runtime error -1146 occurs.
Prompt display in GUI mode
In GUI mode, the PROMPT
instruction opens a modal
window with an OK and a Cancel button, and waits for input from the user.