ID: Q128538
The information in this article applies to:
This article shows by example how to use a READ TIMEOUT with an @SAY.
A READ in FoxPro is defined as a command that activates objects created with @ ... GET and @ ... EDIT commands. This definition comes from the FoxPro version 2.5b for Windows help file. However, you can also activate an @ ... SAY in conjunction with the TIMEOUT Clause.
Create a small program, and place the following code in it:
*** MYSPLASH.PRG ***
*** This sample program demonstrates the use of a READ TIMEOUT with an
*** @...SAY command in the FoxPro versions mentioned above. ***
@15,30 SAY "This is my Splash Screen" Font "Arial", 16
READ TIMEOUT 3
CLEAR
After you run this program, the Command window will disappear, and the
words within the quotes will be displayed at the position specified in the
font specified for three seconds. Then the Command window will come back.
NOTE: A keystroke or mouse click that occurs before the three seconds is up will also break out of the READ TIMEOUT. You could take advantage of this feature to determine if the user is paying attention as in the following variation of the sample program:
*** MYSPLASH2.PRG ***
*** This sample program demonstrates the use of a READ TIMEOUT with an
*** @...SAY command in the FoxPro versions mentioned above with the
*** option to break out. ***
Begtime = SECONDS()
@15,30 SAY "This is my Splash Screen" Font "Arial", 16
@17,30 SAY "Hit Any Key to Continue" Font "Arial", 16
READ TIMEOUT 30 && Will hold text for 30 seconds
CLEAR && Clears the screen
Endtime = SECONDS()
IF Endtime - Begtime < 30 && Determines whether the READ timed out
DO Restofprog
ELSE
DO Testtocont && Procedure to double check before exiting
ENDIF
PROCEDURE Testtocont
Contvar = .F. && Since timed out, initialized to False
@15,30 SAY "Please type T to continue, or F to Quit? (T/F) " GET Contvar
READ
IF Contvar
Do Restofprog
ELSE
QUIT && or RETURN
ENDIF
PROCEDURE Restofprog
*** This is where the program code would go ***
Wait Window " Congratulations, you're in!"
RETURN
Additional reference words: FoxWin 2.50 2.50a 2.50b 2.60 2.60a Introduction
Introductory
KBCategory: kbprg kbcode
KBSubcategory: FxprgRead
Last Reviewed: June 27, 1995