Mouse Click Terminates READ VALID StatementLast reviewed: April 29, 1996Article ID: Q88674 |
The information in this article applies to:
SUMMARYIn a program, a READ is terminated when the user selects a field that is disabled by the VALID clause of the READ.
MORE INFORMATIONThe program listed below defines three objects: AVAR1, AVAR2, and AVAR3. AVAR1 is a GET field with a VALID clause; AVAR2 and AVAR3 are buttons. When the program is run, AVAR2 is disabled and AVAR3 is enabled. When the user enters data in AVAR1 and presses the ENTER key, AVAR2 is enabled and AVAR3 is disabled. The indicator then moves to AVAR2. However, if the user enters data in AVAR1 and then selects AVAR3, the READ is terminated and the program ends. This situation occurs because the program disables AVAR3 when AVAR1 has a value. Selecting the object using the mouse has the same effect as pressing the ENTER key on the keyboard. If you select AVAR3 using the mouse, FoxPro does not have a logical position in which to place the indicator; therefore, it terminates the program. To avoid terminating the program, use a WHEN clause, not a VALID clause, in the READ statement. If you enter data in AVAR1 and select AVAR3, FoxPro returns the indicator to AVAR1 because the mouse selection is invalid. The following sample program demonstrates this situation:
STORE SPACE(10) TO AVAR1 @5,5 GET AVAR1 VALID MYFUNC() @7,5 GET AVAR2 PICT '@*C BUTTON 1' DEFA 0 DISABLE @9,5 GET AVAR3 PICT '@*C BUTTON 2' DEFA 1 ENABLE READ CYCLE FUNCTION MYFUNC IF EMPTY (AVAR1) SHOW GET AVAR2 DISABLE SHOW GET AVAR3 ENABLE ELSE SHOW GET AVAR2 ENABLE SHOW GET AVAR3 DISABLE ENDIF RETURN |
Additional reference words: FoxWin FoxDos 2.00 2.50 2.50a
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |