Microsoft KB Archive/104056

= DEFINE WINDOW Syntax and "Position Off Screen" Error =

Article ID: 104056

Article Last Modified on 12/3/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft FoxPro 2.5b
 * Microsoft FoxPro 2.5a
 * Microsoft FoxPro 2.0
 * Microsoft FoxPro 2.5b for MS-DOS
 * Microsoft FoxPro 2.5a

-



This article was previously published under Q104056



SUMMARY
The DEFINE WINDOW clause can use either the FROM ... TO syntax or the AT ... SIZE syntax to dimension the window.

AT ... SIZE sizes the window according to the font of the defined window itself.

FROM ... TO sizes the window according to the font of the window if there is not an explicit FONT clause on the DEFINE WINDOW command; FROM ... TO with an explicit FONT clause sizes the window according to the font of the screen or parent window.



MORE INFORMATION
DEFINE WINDOW FROM, TO , uses the font of the screen or parent window to locate the upper/left corner (row1,col1). It then uses "foxfont",9 (the default font of a window) to position the lower/right corner (row2,col2). The same amount of information can be placed in the window as is possible in FoxPro for MS-DOS.

If a FONT clause is included in the DEFINE WINDOW ... FROM ... TO command, the command uses the font of the screen or parent window to locate the lower/right corner (row2,col2). This behavior ensures that the dimensions of the window relate to other objects on the screen and other windows in the same way that they do in FoxPro for MS-DOS.

DEFINE WINDOW AT, SIZE , also uses the font of the screen or parent window to locate the upper/left corner of the window (row1,col1). It always uses the font of the defined window to position the lower/right corner (row2,col2). This behavior ensures that the same amount of information can always be placed in the window regardless of its font.

Potential Problems
When you are using the DEFINE WINDOW ... FROM ... TO syntax, if the window font is smaller than the screen font/parent window font, you may receive "position off screen" errors in code that appears to be correct. Remember that when writing to the window you always use the window font. If the window is sized according to the font of the parent window/screen and that font is smaller, there will be fewer usable rows and columns than you might expect.

Platform Differences
In FoxPro for Windows, the four corners of the window will be at the upper/left corners of the row/column coordinates. This is slightly different from FoxPro for MS-DOS, which uses the line-drawing characters and bisects the row/column coordinate.

The window borders do not take up a row/column of their own as they do in FoxPro for MS-DOS.

Additional query words: VFoxWin FoxDos FoxWin POSITION OFF SCREEN FROM TO AT SIZE

Keywords: KB104056

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.