Microsoft KB Archive/98444

{|
 * width="100%"|

-

The information in this article applies to:


 * Microsoft Visual FoxPro for Windows, version 3.0
 * Microsoft FoxPro for Windows, versions 2.5x, 2.6
 * Microsoft FoxPro for MS-DOS, versions 2.0, 2.5x

-

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 &quot;*** INTERRUPTED ***&quot; 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 query words: VFoxWin FoxDos FoxWin 2.50 2.50a 2.50b

Keywords         : FxprgGeneral Version          : 2.50x 2.60 3.00 | 2.00 2.50x Platform         : MS-DOS WINDOWS Issue type       :
 * }