PRB: ON KEY LABEL <key label> KEYBOARD "{ESC}" Does Not Work

ID: Q121961

The information in this article applies to:

SYMPTOMS

Using the ON KEY LABEL to define another key on the keyboard to act as if it were the ESC key does not work.

CAUSE

Issuing the command ON KEY LABEL <key label> KEYBOARD "{ESC}" at the Command Window or in a program will cause the following error:

in FoxPro for MS-DOS:

                         Interrupted
                 <Cancel> <Suspend> <Ignore>

in FoxPro for Windows, and FoxPro for Macintosh:

                       Program Error
                        Interrupted
                 <Cancel> <Suspend> <Ignore>

This error is caused because the ON KEY LABEL routine thinks that it is being interrupted and asks the user to Cancel, Suspend, or Ignore itself.

RESOLUTION

To enable the ON KEY LABEL to define another key on the keyboard as the ESC key without generating an error, add the PLAIN clause:

   ON KEY LABEL <key label> KEYBOARD "{ESC}" PLAIN

By adding this clause, you tell FoxPro to place the literal key label into the keyboard, not the key assignment. It is the key assignment that causes the error to occur.

Additional reference words: FoxWin FoxDos FoxMac on key label keyboard esc escape 2.00 2.50 2.50a 2.50b 2.50c 2.60 2.60a KBCategory: kbprg kbui kbtshoot kbprb KBSubcategory: FxprgGeneral

Last Reviewed: June 27, 1995