Microsoft KB Archive/121961

{| = PRB: ON KEY LABEL KEYBOARD "{ESC}" Does Not Work =
 * width="100%"|

ID: Q121961

The information in this article applies to:


 * Microsoft FoxPro for MS-DOS, Versions 2.5x, 2.6, 2.6a
 * Microsoft FoxPro for Windows, Versions 2.5x, 2.6, 2.6a
 * Microsoft FoxPro for Macintosh, Version 2.5x, 2.6, 2.6a

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 KEYBOARD "{ESC}" at the Command Window or in a program will cause the following error:

in FoxPro for MS-DOS:

Interrupted    in FoxPro for Windows, and FoxPro for Macintosh: Program Error Interrupted    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 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
 * }