How to Change Data in a GET Field from a VALID ProcedureLast reviewed: April 29, 1996Article ID: Q101590 |
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
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |