[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
KEY(n)                   Enable/Disable Key Trapping

 KEY(n) {ON | OFF | STOP}

    Enables or disables the trapping of a specified key via ON KEY(n).

           n    A numeric expression in the range 1 to 20, specifying the
                key to trap, as follows:

                1-10,30,31    Function keys F1 through F10, F11, F12
                11            Cursor Up
                12            Cursor Left
                13            Cursor Right
                14            Cursor Down
                15-25         Keys defined via KEY n, CHR$(KBflag) +
                                                      CHR$(scancode)

          ON    KEY(n) ON activates trapping. If an ON KEY(n) GOSUB
                statement has been executed, QuickBASIC checks before
                executing each statement to see if the specified key has
                been pressed. If it has, QuickBASIC performs the indicated
                GOSUB.

         OFF    KEY(n) OFF deactivates trapping.

        STOP    KEY(n) STOP also deactivates trapping, but QuickBASIC
                continues checking to see if the specified key has been
                pressed. If it has been pressed, a subsequent KEY(n) ON
                results in an immediate trap (provided an ON KEY(n)
                statement with a nonzero line number has been executed).

   -----------------------------------------------------------------------

      Notes:    If the "Checking Between Statements" option is in effect,
                QB checks for communication activity after each statement.
                If the "Event Trapping" option is selected, QB checks
                after each new program line. If neither option is
                selected, no trapping takes place.

                For command-line compilation, /v enables checking after
                each statement, and /w enables checking after each new
                line. If neither switch is used, no trapping takes place.

See Also: ON KEY
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson