Microsoft KB Archive/107837

From BetaArchive Wiki

How to Create a Foundation READ Time-Out

ID: Q107837

2.50 2.50a 2.50b | 2.00 2.50 2.50a 2.50b | 2.50b

WINDOWS          | MS-DOS                | MACINTOSH

kbprg The information in this article applies to:

  • Microsoft FoxPro for Windows, versions 2.5, 2.5a, and 2.5b
  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5, 2.5a, and 2.5b
  • Microsoft FoxPro for Macintosh, version 2.5b

SUMMARY

A foundation READ is commonly used to provide a place for a menu to wait in an application (.APP) or executable file (.EXE) created by FoxPro. However, if the TIMEOUT clause is added to the foundation READ, the foundation READ will not work.

The foundation READ and the TIMEOUT clause will work correctly together if the VALID clause of the foundation READ calls a procedure instead of evaluating a variable, as shown below.

MORE INFORMATION

To create a menu with a foundation READ that works with the TIMEOUT clause, do the following:

1. From the File menu, choose New, and select Menu. Choose OK.

2. Add one or more pads to the menu. One pad should have QUIT as the menu

   prompt. Under Result, select Procedure, and enter the following code for
   the QUIT pad:

      m.quitting = .T.
      CLEAR READ ALL

3. From the Menu menu, choose General Options. Select the Cleanup check

   box. In the cleanup code snippet window, enter the following code:

      m.quitting = .F.
      READ VALID quitting() TIMEOUT 10

      SET SYSMENU TO DEFAULT

      PROCEDURE quitting
      IF m.quitting
         RETURN .T.
      ELSE
         IF READKEY(0) = 6
            RETURN .T.
         ELSE
            RETURN .F.
         ENDIF
      ENDIF

4. From the Program menu, choose Generate. When you are asked if you want

   to save the changes, choose Yes. Enter TIMEOUT as the menu name.

5. In the Command window, enter the following command to display your

   custom menu:

      DO TIMEOUT.MPR

6. Wait 10 seconds. The FoxPro default system menu should appear. Additional reference words: FoxMac FoxDos FoxWin 2.00 2.50 2.50a 2.50b time read KBCategory: kbprg KBSubcategory: FxtoolGeneral

Keywords          : FxtoolGeneral 
Version           : 2.50 2.50a 2.50b | 2.00 2.50 2.5
Platform          : MACINTOSH MS-DOS WINDOWS

Last Reviewed: April 30, 1996
© 1999 Microsoft Corporation. All rights reserved. Terms of Use.