Single Screen Set to Prevent "Too Many READs in Effect"

Last reviewed: April 29, 1996
Article ID: Q106696
The information in this article applies to:
  • Microsoft FoxPro for Windows, versions 2.5, 2.5a, 2.5b
  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5, 2.5a, 2.5b

SUMMARY

If a screen runs another screen, the current number of READs in effect is increased by one. One way to avoid nesting is to have all the screens that call each other in one screen set where only one screen is enabled at a time.

MORE INFORMATION

The following procedure creates a set of screens that can run one another without increasing READ levels by enabling and disabling GETs:

  1. Create a new project and name it ONESCRN.

  2. Add a new screen to the project and name it ONE.

  3. Change the screen type to a window.

  4. Name the window One and title the window Screen 1.

  5. Create a SAY object with "RDLEVEL()" as the expression.

  6. Create two push buttons. Enter "Screen 2" and "Quit" as the push button prompts, and enter "X" in the Variable text box.

  7. Enter the following code in the Valid Code Snippet:

    DO CASE

              CASE x = 1
                 SHOW GETS WINDOW one DISABLED
                 SHOW GETS WINDOW two ENABLED
              CASE x = 2
                 CLEAR READ
           ENDCASE
    
    

  8. Save the screen without saving the environment.

  9. Save the screen again as TWO.

  10. Change the window name to Two and the window title to Screen 2.

  11. Select the push buttons created in step 6.

  12. Change the first push button prompt to Screen 1.

  13. Change the code in the Valid Code Snippet as follows:

    DO CASE

              CASE y = 1
                 SHOW GETS WINDOW two DISABLED
                 SHOW GETS WINDOW one ENABLED
              CASE y = 2
                 CLEAR READ
           ENDCASE
    
    

  14. Name the window Two and title the window Screen 2.

  15. Save the screen.

  16. Add the screen TWO.SCX to the screen set One in the project.

  17. Build the project with the Rebuild Project option.

  18. Run the ONE.SPR program.

Note that the RDLEVEL() command never returns a value greater than 1, even when you are switching between screens 1 and 2.

For additional information about this topic, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q106697
   TITLE     : How to Prevent "Too Many READs in Effect" Error Message

The method described in Q106697 is faster, but requires more memory and more resources.


Additional reference words: FoxDos FoxWin 2.00 2.50 2.50a 2.50b
errmsg err
msg
Window Screen switch
KBCategory: kbenv kbprg kberrmsg
KBSubcategory: FxenvMemory


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: April 29, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.