HP 3000 Manuals

RESPONSE [ HP Business BASIC/XL Reference Manual ] MPE/iX 5.0 Documentation


HP Business BASIC/XL Reference Manual

RESPONSE 

The RESPONSE function returns information about the method and type of
input last entered from the keyboard.  The statements listed below affect
the value that is returned by this function:

 *  INPUT

 *  LINPUT

 *  TINPUT

 *  ACCEPT

 *  PRESS KEY

 *  FLUSH INPUT

Likewise, the actions that are listed below affect the value that is
returned by the RESPONSE function:

 *  Pressing any branch-during-input key.

 *  Pressing the HALT key (control Y).

 *  Specifying a HARD HALT.

 *  Execution of the PRESS KEY statement.


NOTE Input using the ENTER and LENTER statements does not affect the value returned by this function.
A FLUSH INPUT statement sets the value returned by RESPONSE to zero. This function can be used in conjunction with the input statements and softkeys to determine how the user has a responded to a program's input statement. Table 5-7 lists the possible values returned by this function with their corresponding meanings. Table 5-7. RESPONSE Function Return Values and Their Meanings --------------------------------------------------------------------------------------------- | | | | Value | Meaning | | | | --------------------------------------------------------------------------------------------- | | | | -1 through -8: | One of the user-definable keys , f1 through f8, was pressed. The | | | value corresponds to the negative number of the actual key pressed. | | | | --------------------------------------------------------------------------------------------- | | | | -255: | The HALT key was pressed. | | | | --------------------------------------------------------------------------------------------- | | | | 0: | There has not been any input entered or a FLUSH INPUT statement | | | preceded the function call. | | | | --------------------------------------------------------------------------------------------- | | | | 1: | The HARD HALT key was pressed. | | | | --------------------------------------------------------------------------------------------- | | | | 2: | A timeout has occurred. This occurs during the execution of a TINPUT | | | or ACCEPT statement. | | | | --------------------------------------------------------------------------------------------- | | | | 10: | The last previous input is valid. | | | | --------------------------------------------------------------------------------------------- | | | | 11: | The input was accepted without a carriage return. The TINPUT and | | | ACCEPT statements allow suppression of the carriage return by | | | specification of the CHARS and NOLF options. | | | | --------------------------------------------------------------------------------------------- Syntax RESPONSE Examples 10 ON KEY 1 GOSUB Help;LABEL="Help" 100 LOOP 200 INPUT "Your Name; ";Name$ 300 EXIT IF RESPONSE > 2 400 ENDLOOP 500 STOP 600 HELP:! 700 PRINT "In Help" 800 RETURN The program above continues to prompt for the user's name until it is entered on the keyboard. If the user presses f1, the program executes the specified HELP subroutine. When it returns from the HELP subroutine, since RESPONSE returns a value of -1, the program reprompts for the user's name.


MPE/iX 5.0 Documentation