@READ_INT

@READ_INT reads a integer value entered from the keyboard.  The digits are displayed in a window by applying the specified picture format at the specified location as each digit is entered.  When the input from the keyboard has been terminated, this system function returns the integer value entered from the keyboard.  Since the integer value is displayed as it is entered, the specified window must be pasted before using this function.

When @READ_INT starts execution, the cursor is pointing at the right-most column of the input field.  As the digits are being entered from the keyboard, the digits are shifted to the left and the cursor remains at the right-most column.

During the input process, the only editing allowed is to delete the characters one at a time with the Delete /Rubout key.  The input from the keyboard is terminated if:

These system fields are also used by the FILL statement/command. Be aware that any changes that are made to these user-modifiable system fields will also affect the FILL statement/command.

RETURN

When the input from the keyboard is complete, the integer value entered from the key­board is returned as the value of this system function.

There is another value returned by this system function.  This value is stored in the integer system field @TERM_CODE and contains the keycode of the key which was used to terminate the data input from the keyboard.  For example, if the Tab key is used to terminate the input, the value of @TERM_CODE is 9.  However, if the input is terminated because the number of characters entered from the keyboard is equal to the width of the input field, @TERM_ CODE has a value of zero.

SYNTAX

@READ_INT (window_id start_row start_column width rendition picture_format [,default_value])

window_id

is an integer system field, Global Storage (GS) field, or user-defined field that contains the window ID assigned to the window.

start_row

is an integer expression that specifies the row position where the input field begins in the window.

start_column

is an integer expression that specifies the column position where the input field begins in the window.

width

is an integer expression that specifies the width or number of columns in the input field.

rendition

specifies the video attributes for the input field.  The video attributes for the entire input field are changed and the original video attributes are not restored.  More than one attribute may be defined by separating the attributes with plus signs.

   

The valid video attributes are:

  • NORMAL specifies normal video attribute.  [default setting]
  • BLINK specifies blinking video attribute.
  • BOLD specifies bold face video attribute.
  • REVERSE specifies reverse video attribute.
  • UNDERLINE specifies underlining video attribute.

picture_format

is a quoted string literal that specifies the desired picture format.  This format controls the form in which the integer value will be displayed.  If an empty string is specified, a free format integer value will be displayed.  See the ACCENT R Reference Manual for additional details on picture formats.

default_value

is an optional integer argument that specifies a default value which is returned if a new value is not obtained from the keyboard.

EXAMPLE

@READ_INT(MAIN_ID 5 10 3 REVERSE "" 50) TO RATING

SCREEN CHANGE_RENDITION USING MAIN_ID 5 10 1 3 NORMAL

This example demonstrates a procedure that obtains the current stock rating.  When the first statement is executed, the cursor is positioned at row 5, column 13 of the window.  The rendition of the input field (row 5, column 10 to row 5, column 13) is changed to reverse video with the default stock rating of 50 displayed.  If only the Return key is pressed, the default integer value of 50 will be stored in RATING.  If "75" is entered and the Return key is pressed, this statement stores the integer value of 75 into RATING.

The original rendition is not restored by @READ_INT.  The input field's original rendition is restored by the SCREEN CHANGE_RENDITION statement.

SEE ALSO:  SCREEN CHANGE_RENDITION Statement (later in this section).

Back to System Functions    Next page @READ_KEYSTROKE