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:
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:
CLEAR ALL
CLEAR
DEFINE WINDOW awind FROM 1,1 TO 10,30
ACTIVATE WINDOW awind
@1,7 GET m.what DEFAULT " "
@3,1 SAY "DATA: "
@3,7 GET m.data DEFAULT " " VALID dv()
READ CYCLE
RELEASE WINDOW awind
FUNCTION dv
IF ALLTRIM(m.data) !="EXIT" && Only "valid" data in this example
&& is "EXIT" to exit the field.
m.data=" " && If data not valid, clear the data.
SHOW GET m.data && Refresh the GET.
_CUROBJ=OBJNUM(m.data) && Stay in the same GET.
RETURN .T. && Must return TRUE to clear the GET field.
ENDIF
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