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

Last reviewed: June 27, 1995
Article 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 "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



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 27, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.