Registrations are now open. Join us today!
There is still a lot of work to do on the wiki yet! More information about editing can be found here.
Already have an account?

Microsoft KB Archive/101590

From BetaArchive Wiki

How to Change Data in a GET Field from a VALID Procedure

ID: Q101590

2.00 2.5x 2.6x | 2.5x 2.6x 3.00

MS-DOS         | WINDOWS

kbprg The information in this article applies to:

  • Microsoft Visual FoxPro for Windows, version 3.0
  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5x, 2.6x
  • Microsoft FoxPro for Windows, versions 2.5x, 2.6x

When a GET field's VALID procedure returns FALSE, the original value contained by the field (the value before the user entered it) will be restored, and the user will get an error message indicating that the value entered was invalid. If the programmer wants to blank the field (fill it with spaces, for example) rather than restore the original value, the VALID procedure must return a value other than FALSE. The programmer must then use other methods for keeping the user in the field, such as setting _CUROBJ to the same GET object or returning 0 (zero).

The following program illustrates how to have the VALID procedure return TRUE and yet make sure the user still remains in the same GET field through use of the _CUROBJ system variable:

   DEFINE WINDOW awind FROM 1,1 TO 10,30
   @1,7 GET m.what DEFAULT "      "
   @3,1 SAY "DATA: "
   @3,7 GET DEFAULT "      " VALID dv()

   IF ALLTRIM( !="EXIT"    && Only "valid" data in this example
                                  && is "EXIT" to exit the field."      "         && If data not valid, clear the data.
      SHOW GET         && Refresh the GET.
      _CUROBJ=OBJNUM(  && Stay in the same GET.
      RETURN .T.              && Must return TRUE to clear the GET field.

Additional reference words: VFoxWin 3.00 FoxDos FoxWin 2.00 2.50 2.50a 2.50b 2.60 2.60a KBCategory: kbprg KBSubcategory: FxprgGeneral

Keywords          : FxprgGeneral 
Version           : 2.00 2.5x 2.6x | 2.5x 2.6x 3.00
Platform          : MS-DOS WINDOWS

Last Reviewed: April 30, 1996
© 1999 Microsoft Corporation. All rights reserved. Terms of Use.