FIX: Output from Screen Program Goes to Current Output Window

ID: Q96291

2.00 2.50 MS-DOS kbprg kbfixlist kbbuglist kberrmsg

The information in this article applies to:

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 "tryit" (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 "Position is off the screen" 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("tryit")
     DEFINE WINDOW tryit ;

If TRYIT.SPR, TRYIT.SCX, or another window named tryit is on screen, WEXIST ("tryit"), 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 "tryit" window is too small for the coordinates for the @ ... SAY or @ ... GET commands in the screen program (for example "tryit" 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 "tryit" 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.

REFERENCES

"Developer's Guide," version 2.0, Chapter 2, "Screen Layout"

Additional reference words: FoxDos 2.00 2.50 buglist2.00 fixlist2.50 genscrn errmsg err msg KBCategory: kbprg kbfixlist kbbuglist kberrmsg KBSubcategory: Solution Type : kbfix

Last Reviewed: September 22, 1997