Microsoft KB Archive/96291

{| = FIX: Output from Screen Program Goes to Current Output Window =
 * width="100%"|

ID: Q96291

2.00 2.50 MS-DOS kbprg kbfixlist kbbuglist kberrmsg

The information in this article applies to:


 * Microsoft FoxPro for MS-DOS, versions 2.0 and 2.5

SYMPTOMS
When you are executing a screen program (.SPR) in which the screen is displayed in a window, the @ ... SAY or @ ... GET commands may not be displayed inside the window that was created in the screen program, or the following error message may be generated:

Position is off the screen

CAUSE
There are two ways to reproduce this problem:

Method 1
1. Create a new screen program.

2. In the Screen Layout dialog box, select the Window radio button,

and type &quot;tryit&quot; (without the quotation marks) in the Name text box. 3. Create a SAY field in the screen to display a text string. 4. Save the screen as TRYIT.SCX (without the quotation marks), and

generate the screen program as TRYIT.SPR.

If either of the windows, TRYIT.SCX or TRYIT.SPR, is on screen (possibly minimized for convenience), the output from TRYIT.SPR will go to the desktop.

Method 2
1. Follow steps 1-4 above.

2. In the Command window, type the following commands:

DEFINE WINDOW tryit FROM 2,2 TO 5,15 DO tryit.spr Either the error message &quot;Position is off the screen&quot; will appear, or the output will appear in the window tryit, as defined in the Command window. This behavior occurs because the following code is generated in TRYIT.SPR:

IF NOT WEXIST(&quot;tryit&quot;) DEFINE WINDOW tryit ; If TRYIT.SPR, TRYIT.SCX, or another window named tryit is on screen, WEXIST (&quot;tryit&quot;), evaluates to true, and the window named tryit with the Screen Builder is not defined and activated. The output will go either to the desktop, or to the previously defined tryit window. If the activated &quot;tryit&quot; window is too small for the coordinates for the @ ... SAY or @ ... GET commands in the screen program (for example &quot;tryit&quot; is DEFINEd FROM 1,1 to 5,5 and the SAY/GET position in the .SPR file is 6,10), the error message will appear.

RESOLUTION
In the SETUP code for the screen, use the following generator directive:

#REDEFINE This will ensure that the window named &quot;tryit&quot; with the Screen Builder will always be defined, regardless of whether a window of the same name already exists.

STATUS
Microsoft has confirmed this to be a problem in FoxPro version 2.0 for MS-DOS. This problem was corrected in FoxPro version 2.5 for MS-DOS.