ID: Q113539
The information in this article applies to:
The RESTORE SCREEN FROM <memory_variable> command produces a "Variable
'memory_variable' not found" error message. These symptoms may occur when
you convert a dBASE IV application that exploits the global nature of a
variable that contains a screen image.
In FoxPro, the scope of the variable created by SAVE SCREEN TO <memory_variable> is private. The variable therefore ceases to exist when execution of the function or procedure in which it was created terminates due to a RETURN statement.
In dBASE IV, the scope of the variable created by SAVE SCREEN TO <memory_variable> is global. The variable therefore continues to exist when execution of the function or procedure in which it was created terminates due to a RETURN statement.
To avoid this problem and emulate the behavior of dBASE IV, modify the dBASE IV program by creating a PUBLIC variable to hold the screen image.
For an example of this modification, see "Workaround" in the "More Information" section below.
When executed in dBASE IV 2.0, the following code will not produce an error message. When executed in FoxPro, however, this code will produce an error message.
PROCEDURE ScreScop
@ 10,10 SAY "Hello World"
DO ScrnSave
RESTORE SCREEN FROM myscreen
RETURN
PROCEDURE ScrnSave
* In dBASE, this command creates a variable
* called myscreen. The variable has a global
* scope, so it continues to exist when execution
* of PROCEDURE ScrnSave is terminated by the
* RETURN statement.
SAVE SCREEN TO myscreen
CLEAR
RETURN
The following code sample has been modified so that it can be executed in FoxPro without producing an error message.
PROCEDURE ScreScop
@ 10,10 SAY "Hello World"
DO ScrnSave
RESTORE SCREEN FROM myscreen
RETURN
PROCEDURE ScrnSave
* In this example, a public variable is created
* to hold the screen image. This variable will
* continue to exist when the RETURN statement
* is executed. The program will now behave
* as expected.
PUBLIC myscreen
SAVE SCREEN TO myscreen
CLEAR
RETURN
Additional reference words: FoxMac FoxDos FoxWin 2.00 2.50 2.50a 2.50b 2.60
errmsg err msg
KBCategory: kb3rdparty kbprg kberrmsg kbcode
KBSubcategory: FxinteropDbase
Last Reviewed: June 28, 1995