Prompt
Displays a character string in the window and accepts input from the application user.
Syntax
fieldname = prompt [noecho] charstringexpr
[with style = menuline | popup [(option=value
{, option=value})]]
fieldname
Specifies the name of a field (of character data type) to which your response is assigned. Can be a form field or local variable. If the response is longer than the field, the response is truncated on the right to fit.
noecho
Indicates that your response to the prompt must not be displayed in the window as it is typed. If fieldname is a displayed field, the response appears in the field.
charstringexpr
Specifies a string expression with a maximum length of 255 characters for the display of a message on the screen.
option
Specifies one of four options—startcolumn, startrow, columns, and rows—used in the with style clause to locate and create the pop‑up box for displaying a prompt.
value
Specifies the value assigned to each popup style option parameter, specifying one of the following for the pop‑up box: starting column position, starting row position, number of columns, or number of rows (including borders).
The values for startcolumn and startrow specify the coordinates of the upper left corner of the pop‑up form. The value can be a keyword, integer constant, or integer variable as follows:
default | 0
Specifies the VIFRED definition or default
int
Specifies a positive integer indicating the number of rows or columns from the origin. The origin (1,1) is the upper left corner of the screen.
intvar
Specifies a 4GL expression evaluating to 0 or a positive integer
The value of rows, if specified, must be at least 4. Three of the rows are used by the display, leaving one line for text. If you want to display four lines of text, specify seven as the value of rows. The value of columns, if specified, must be at least 16.
Description
The 4GL prompt statement enables the application to request your input. It displays a string in the window, accepts your input, and places your response in a designated field.
• To display the prompt on the menu line, use with style=menuline or omit the style clause.
• To display the prompt in a pop‑up box at a window location you specify, use with style=popup. If there is not enough room in the window to start the pop‑up box at your specified location, the forms system displays the form in full‑screen width. If you do not specify a location for the pop‑up, it is displayed at the bottom of the frame.
Examples
Prompt for report name and place response in the local variable called answer:
answer := prompt 'Enter the report name: '
Prompt the user for a password:
password := prompt noecho
'Enter your password: '
Prompt the user, using the pop-up style display, for the department of the person whose name appears in the Fname and Lname fields:
answer := prompt
'Enter the department for ' + fname +
' ' + lname + ':'
with style=popup;
Last modified date: 04/03/2024