PRB: Pressing ESC Key Clears Contents of Text Box in a ToolbarID: Q131301 3.00 WINDOWS
The information in this article applies to:
SYMPTOMSPressing the ESC key before pressing the ENTER key when the insertion point is in a text box, clears the content of the text box. However, doing the same thing in a combo box does not produce the same behavior.
CAUSEThe ESC key is seen as a cancel operation for a text box object. In the combo box object, the ESC key is a terminator for the drop-down list only.
WORKAROUNDIn the text box object, it is possible to use the Keypress event to trap for the ESC key. If the ESC key is pressed, a dialog box prompting the user to save the data can be displayed. Please see the "Step-by-Step Example" section of this article.
STATUSThis behavior is by design.
MORE INFORMATIONThe following example creates a form with a text box, and traps for the ESC key in the text box. When the escape key is pressed, a dialog is displayed, and if the user answers No, the data is not cleared from the text box.
Step-by-Step Example1. Create a form. 2. Place a text box on the form. 3. Place the following code in the Keypress event handler:
4. Save and run the form. When the form displays, type something in the
Additional reference words: 3.00 VFoxWin escape
KBCategory: kbprb
KBSubcategory: FxtoolFormdes
|
Last Reviewed: May 22, 1998 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |