@ ... GET-PUSH Order of WHEN / VALID Execution in FoxPro

ID: Q88873

The information in this article applies to:

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 "push1" button.

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

   PROCEDURE func1
   WAIT WINDOW "In the When"

   PROCEDURE func2
   WAIT WINDOW "In the Valid"

As "push1" 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

Last Reviewed: June 27, 1995