Click to Rate and Give Feedback
MSDN
MSDN Library
Visual FoxPro
Reference
Language Reference
Commands
 ON ESCAPE Command
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
Visual FoxPro 9.0 SP2
ON ESCAPE Command

Specifies a command that executes when you press the ESC key during program or command execution.

ON ESCAPE   [Command]

Parameters

Command

Specifies the Visual FoxPro command to execute. After the command executes, program execution resumes on the line immediately following the program line that was executing when you pressed ESC. However, if a procedure specified with ON ESCAPE includes RETRY, the program line that was executing when you pressed ESC executes again.

Typically, ON ESCAPE uses DO to execute a procedure.

If both ON ESCAPE and ON KEY are in effect and you press ESC, Visual FoxPro executes the command specified with ON ESCAPE.

Use ON ESCAPE without a command to cause no command to execute when ESC is pressed (the default).

NoteNote

Visual FoxPro doesn't execute an ON ESCAPE routine if SET ESCAPE is OFF.

The following example sets up an infinite loop but defines an ON ESCAPE routine to exit it.

SET ESCAPE ON
ON ESCAPE DO stopit
WAIT WINDOW 'Press ESC to stop loop' NOWAIT
glMoreLoop = .T.

DO WHILE glMoreLoop
ENDDO
RETURN

PROCEDURE stopit
glMoreLoop = .F.
RETURN
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content      
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker