ID: Q92344
The information in this article applies to:
When a GET statement VALID clause contains a user-defined function (UDF), the UDF is executed each time the user leaves the field.
The following code illustrates that a VALID clause UDF is executed each time the user leaves the field. After creating the two files below, enter DO TEST.PRG at the dot prompt. The code demonstrates that whenever the user presses TAB or ENTER to move to the next GET field, the UDF executes, even when the user does not change the value of the "num2" field from zero.
   * TEST.PRG
   CLEAR
   SET TALK OFF
   STORE 0 TO num1,num2,num3
   @3,10 SAY "NUMBER 1: " GET num1
   @5,10 SAY "NUMBER 2: " GET num2 VALID myudf()
   @7,10 SAY "NUMBER 3: " GET num3
   READ SAVE
   * MYUDF.PRG
   PUBLIC mreturn
   mreturn=.F.
   @15,15 SAY "IN MYUDF()                            "
   IF num2<>0
     @15,26 SAY "AND VALUE CHANGED FROM ZERO"
     mreturn=.T.
   ENDIF
   RETURN mreturn
Additional reference words: FoxWin FoxDos 2.10 2.00 2.50 2.50A 2.x fox base
KBCategory: kbprg
KBSubcategory:FxprgGeneral
Last Reviewed: July 5, 1995