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:
- Create a new project and name it ONESCRN.
- Add a new screen to the project and name it ONE.
- Change the screen type to a window.
- Name the window One and title the window Screen 1.
- Create a SAY object with "RDLEVEL()" as the expression.
- Create two push buttons. Enter "Screen 2" and "Quit" as the
push button prompts, and enter "X" in the Variable text box.
- 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
- Save the screen without saving the environment.
- Save the screen again as TWO.
- Change the window name to Two and the window title to Screen 2.
- Select the push buttons created in step 6.
- Change the first push button prompt to Screen 1.
- 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
- Name the window Two and title the window Screen 2.
- Save the screen.
- Add the screen TWO.SCX to the screen set One in the project.
- Build the project with the Rebuild Project option.
- 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.
|