How to Test for Entry in a Field in Visual FoxPro & FoxPro 2.xID: Q135110 The information in this article applies to:
SUMMARYIf you think you need to use a WHEN clause (used in FoxPro version 2.x @...GET fields on screens) when working in a Visual FoxPro form, you may be able to use an Init, When, or GotFocus event procedure to accomplish your goal:
MORE INFORMATIONThe When and Init events are not equivalent. The Init event procedure runs only once -- when the object is created. The When event procedure runs each time the field is entered, right before it receives the focus. If you want the code to fire a single time when entering the object (field), use the Init event procedure instead of the When event procedure. Usually, however, you will want to use the When event procedure. Following are two step-by-step procedures that demonstrate how to use the When event in Visual FoxPro versus the WHEN clause in FoxPro version 2.x.
Using the WHEN Clause in FoxPro 2.x w/EX1.SPR Sample Screen1. In FoxPro for Windows, open a screen, and draw an input field. 2. Type X as the input. 3. Enter the WHEN Clause, and type:
4. Close the dialog box, for the input field, and save the screen as EX1.
5. On the Program menu, click Generate. Generate the screen as EX1.SPR, 6. Type DO EX1.SPR from the Command window, and notice the Wait Window
Using When, Init, & GotFocus Events in Visual FoxPro w/EX2.SCX Sample Form1. In Visual FoxPro, on the File menu, click New and choose Form. Then 2. Using the Form controls, draw a text object on the form. Select it, and
3. Select the When Event from the Form controls to bring up a procedure
4. Select the GotFocus Event from the Form controls to bring up a procedure
5. On the Form menu, click Run Form.
6. When you are asked to save the form, save it as EX2.SCX. The Wait
REFERENCESPlease see the Visual FoxPro Help menu for more information. Additional reference words: 2.60a 3.00 VFoxWin FoxWin Move Into Valid Click Begin KBCategory: kbtool KBSubcategory: FxtoolSbuilder |
Last Reviewed: August 20, 1995 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |