SET ESCAPE OFF Does Not Disable the ESC Key

ID: Q98444

2.50x 2.60 3.00 | 2.00 2.50x

WINDOWS         | MS-DOS
kbprg

The information in this article applies to:

SUMMARY

The command SET ESCAPE OFF does not disable the ESC key.

MORE INFORMATION

SET ESCAPE OFF keeps the user from interrupting executing lines of code by pressing the ESC key; however, SET ESCAPE OFF will not prevent a user from escaping from an active READ. The reason is that a READ, unlike most commands, creates a wait state; that is, it begins a period of waiting (often for input) that continues. Since the READ instruction may not finish for some time, keyboard input, including the ESC key, is interpreted by the READ, not by SET ESCAPE OFF, which cannot trap the ESC key in the middle of an executing instruction; therefore, the READ reacts to the ESC key (and often this means a screen with active GETs is terminated).

If the ESC key is pressed while non-wait-state lines of code are executing, the ESC key will be buffered temporarily until the current instruction finishes, and then the ESC key will be trapped as expected, permitting continued program execution.

The SET ESCAPE command determines whether FoxPro will interrupt executing code when the ESC key is pressed. If SET ESCAPE is ON and code is being executed, FoxPro will display the "*** INTERRUPTED ***" error message. If SET ESCAPE is OFF, the program will not be halted. If a READ is in effect and the program is sitting idle at that READ when the ESC key is pressed, the READ will be terminated regardless of the setting of ESCAPE and no message will appear.

To disable the ESC key, issue the following command:

   ON KEY LABEL ESC *

This command completely disables the ESC key until ON KEY LABEL ESC is issued. To disable any other key, substitute the appropriate key name for ESC in the above command.

NOTE: If you have saved the environment with the screen or are opening a view, the SET ESCAPE OFF and ON KEY LABEL ESC * commands may not work as expected if the environment or view had different settings for these commands. To work around this, you can explicitly enter these commands in the Command window before saving the environment or view. An alternative workaround regarding the environment is to not save the environment with the screen; instead use code to explicitly create the environment.

Additional reference words: VFoxWin 3.00 FoxDos FoxWin 2.00 2.50 2.50a 2.50b 2.60 KBCategory: kbprg KBSubcategory: FxprgGeneral

Keywords          : FxprgGeneral 
Version           : 2.50x 2.60 3.00 | 2.00 2.50x
Platform          : MS-DOS WINDOWS

Last Reviewed: April 30, 1996