How to Use a READ TIMEOUT with an @SAY

Last reviewed: June 27, 1995
Article ID: Q128538
The information in this article applies to:
  • Microsoft FoxPro for Windows, versions 2.5, 2.5a, 2.5b, 2.6, 2.6a

SUMMARY

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.

MORE INFORMATION

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


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 27, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.