Requests input and places that input in the screen buffer (frame).
The PROMPT-FOR statement is a combination of the following statements:
PROMPT-FOR [ STREAM stream | STREAM-HANDLE handle ] [ UNLESS-HIDDEN ] { {field [ format-phrase ] [ WHEN expression ] } |{ TEXT ( {field [ format-phrase ] [ WHEN expression ] }... ) } |{ constant [ { AT | TO }n ] [ VIEW-AS TEXT ] [ FGCOLOR expression] [ BGCOLOR expression] [ FONT expression] } | SPACE [ ( n ) ]| SKIP [ ( n ) ]| ^ }... [ GO-ON ( key-label... ) ] [ IN WINDOW window ] [ frame-phrase ] [ editing-phrase ] |
PROMPT-FOR [ STREAM stream | STREAM-HANDLE handle ] [ UNLESS-HIDDEN ] record [ EXCEPT field...] [ IN WINDOW window ] {[ frame-phrase ]} |
This field parameter is demonstrated in the following program:
DEFINE VARIABLE ix AS INTEGER NO-UNDO INITIAL 3. PROMPT-FOR ix. MESSAGE "Record buffer" ix SKIP(0) "Screen buffer" INPUT x. |
The program does the following:
In the case of array fields, array elements with constant subscripts are treated just like any other field. Array fields with no subscripts or in the FORM statement are expanded as though you had typed in the implicit elements. See the DISPLAY statement reference entry for information on how array fields with expressions as subscripts are handled.
If you enter more characters than the format for the field allows, the AVM discards the extra characters. The character fields must have formats of the form x(n). A blank in the first column of a line marks the beginning of a paragraph. Lines within a paragraph are treated as a group and will not wrap into other paragraphs.
The following table lists the keys you can use within a TEXT field and their actions.
Key | Action |
---|---|
APPEND-LINE | Combines the line the cursor is on with the next line. |
BACK-TAB | Moves the cursor to the previous TEXT field. |
BREAK-LINE | Breaks the current line into two lines beginning with the character the cursor is on. |
BACKSPACE | Moves the cursor one position to the left and deletes the character at that position. If the cursor is at the beginning of a line, BACKSPACE moves the cursor to the end of the previous line. |
CLEAR | Clears the current field and all fields in the TEXT group that follow. |
DELETE-LINE | Deletes the line the cursor is on. |
NEW-LINE | Inserts a blank line below the line the cursor is on. |
RECALL | Clears fields in the TEXT group and returns initial data values for the group. |
RETURN | If you are in overstrike mode, moves to the next field in the TEXT group on the screen. If you are in insert mode, the line breaks at the cursor and the cursor is positioned at the beginning of the new line. |
TAB | Moves to the field after the TEXT group on the screen.If there is no other field, the cursor moves to the beginning of the TEXT group. |
In this procedure, the s-com, or Order Comments field is a TEXT field. Run the following procedure and enter text in the field to see how the TEXT option works:
r-text.p
DEFINE VARIABLE s-com AS CHARACTER NO-UNDO FORMAT "x(40)" EXTENT 5. FORM "Shipped :" Order.ShipDate AT 13 SKIP "Misc Info :" Order.Instructions AT 13 SKIP(1) "Order Comments :" s-com AT 1 WITH FRAME o-com CENTERED NO-LABELS TITLE "Shipping Information". FOR EACH Customer NO-LOCK, EACH Order OF Customer: DISPLAY Customer.CustNum Customer.Name Order.OrderNum Order.OrderDate Order.PromiseDate WITH FRAME order-hdr CENTERED. UPDATE Order.ShipDate Order.Instructions TEXT(s-com) WITH FRAME o-com. s-com = "". END. |
When you list a key in the GO-ON option, you use the keyboard label of that key. For example, if you want the AVM to take the GO action when the user presses F2, you use the statement GO-ON(F2). If you list more than one key, separate them with spaces, not commas.
Identifies processing to take place as each keystroke is entered. This is the syntax for editing-phrase:
For more information on editing-phrase, see the EDITING phrase reference entry.
To use PROMPT-FOR with a record in a table defined for multiple databases, you must qualify the record's table name with the database name. See the Record phrase reference entry for more information.
The r-prmpt.p procedure requests a customer number from the user and stores that number in the screen buffer. The FIND statement reads a record from the Customer database table.
r-prmpt.p
REPEAT: PROMPT-FOR Customer.CustNum. FIND Customer USING Customer.CustNum NO-ERROR. IF NOT AVAILABLE Customer THEN DO: MESSAGE "No such customer number.". UNDO, RETRY. END. DISPLAY Customer.Name Customer.Phone Customer.SalesRep. END. |
The r-prmpt2.p procedure requests the initials of a sales representative and stores those initials in the screen buffer. The FIND statement uses the initials stored in the screen buffer to read a record from the SalesRep database table. After finding the record, the procedure displays sales rep information.
r-prmpt2.p