Microsoft KB Archive/88873

{| = @ ... GET-PUSH Order of WHEN / VALID Execution in FoxPro =
 * width="100%"|

ID: Q88873

The information in this article applies to:


 * Microsoft FoxPro for MS-DOS, versions 2.0, 2.5, and 2.5a
 * Microsoft FoxPro for Windows, versions 2.5 and 2.5a

SUMMARY
It may appear that the VALID clause of an @ ... GET - PUSH command is executed before the WHEN clause of an @ ... GET - PUSH command, when in fact the WHEN clause is executed as the cursor arrives at the GET object, while the VALID clause is executed as the object is pushed or exited.

MORE INFORMATION
The following example illustrates the order of execution by using the WAIT WINDOW command to display the program flow. As the GET objects are placed on the screen, READ CYCLE activates each GET object, starting with the &quot;push1&quot; button.

x=&quot;&quot; y=&quot;&quot; @ 1,4 GET x ; PICTURE &quot;@*HN push1&quot; ; SIZE 1,11,1 ; DEFAULT 1 ; WHEN func1 ; VALID func2 @ 2,4 GET y ; PICTURE &quot;@*HN push2&quot; ; SIZE 1,11,1 ; DEFAULT 1 READ CYCLE

PROCEDURE func1 WAIT WINDOW &quot;In the When&quot;

PROCEDURE func2 WAIT WINDOW &quot;In the Valid&quot; As &quot;push1&quot; is activated, note that the WHEN clause is executed as the cursor arrives at the object. Once the button is pushed, either by pressing the ENTER key, or by clicking the mouse, note that the VALID clause is then executed. Additional reference words: FoxDos FoxWin 2.00 2.50 2.50a KBCategory: kbprg KBSubcategory: FxprgGeneral
 * }