ID: Q121414
The information in this article applies to:
Defining a window to be a proportionate size of another window does not work the same way in FoxPro for Macintosh and FoxPro for Windows. Although it works as expected in FoxPro for Windows, trial and error may be the only way to accomplish this in FoxPro for Macintosh.
To illustrate the differences between platforms, run the following sample program. This program can be run on both the Windows and Macintosh platforms. On the Windows platform, the child windows will be one-fourth the size of the parent window. On the Macintosh platform, they will be somewhat larger than one-fourth the size of the parent window.
ZOOM WINDOW SCREEN MAX
IF _MAC
SET MACDESKTOP OFF
ENDIF
MODIFY WINDOW SCREEN FONT "FoxFont",9
DEFINE WINDOW A FROM 0,0 TO SROWS()*.8,SCOLS()*.8 ;
FONT "FoxFont",9 FLOAT TITLE "A"
ACTIVATE WINDOW A
DEFINE WINDOW B FROM 0,0 TO WROWS("A")*.5,WCOLS("A")*.5 ;
FONT "FoxFont", 9 IN WINDOW A FLOAT TITLE "B"
ACTIVATE WINDOW B
DEFINE WINDOW C FROM WROWS("A")*.5,0 TO WROWS("A"),WCOLS("A")*.5 ;
FONT "FoxFont",9 IN WINDOW A FLOAT TITLE "C"
ACTIVATE WINDOW C
The SROWS() and SCOLS() functions return the number of rows and columns
available in the main FoxPro window. Window A in the above program is
defined to be 80 percent of the size of the main FoxPro window.
The WROWS() and WCOLS() functions return the number of rows and columns in a specified window. In the above program, the specified window is window A. Windows B and C are defined to be one-fourth the size of window A, window B being in the top-left quadrant of window A and window C being in the bottom- left quadrant of window A.
All windows are defined with FoxFont, 9-point size, which is a fixed space font that is available on both platforms. On the Macintosh platform, MACDESKTOP is set to OFF so the windows will reside on the main FoxPro window rather than the Macintosh desktop.
The easiest way to check the size of the child windows in relation to the parent window is to grab the title bar of window C and move it while holding down the (left) mouse button. The dotted line will show the new position; the original position will not change until the mouse button is released. In FoxPro for Windows, the child windows will be one-fourth the size of the parent window.
You can also place the following commands in the Debug window to see the numbers behind the window sizes. SYSMETRIC(9) returns the height of the window title, in pixels. FONTMETRIC(1,"FoxFont",9) returns the character height in pixels.
Function Windows Macintosh
------------------------------------------------------------------
WROWS("A") 27.833 39.111
WROWS("B") 12.250 19.667
WROWS("C") 12.250 19.667
SYSMETRIC(9) 20 18*
FONTMETRIC(1,"FoxFont",9) 12 9*
* These are the values returned in FoxPro 2.6a for Macintosh. In FoxPro
2.5c, they are 1 and 9 respectively.
The WCOLS() function for the windows could also be used, but the WROWS()
function better illustrates the situation.
In FoxPro for Windows, the WROWS("A") value can be reconciled by adding the WROWS() function for windows B and C, along with the height of the title bar for each window (20 pixels/12 pixels per column*2 = 3.334):
12.250+12.250+3.334=27.833 (with minor rounding differences)
The same is not true on the Macintosh platform. The sum of just the
values returned for WROWS() for windows B and C is greater than
WROWS("A"):
19.667+19.667=39.334
FoxPro "Language Reference," version 2.5
Additional reference words: FoxMac FoxWin 2.50 2.50a 2.50b 2.50c 2.60 2.60a KBCategory: kbprg kbcode KBSubcategory: FxtoolDebug
Last Reviewed: August 28, 1995