How to Convert Screen Object Positions Between PlatformsLast reviewed: April 29, 1996Article ID: Q106161 |
The information in this article applies to:
SUMMARYWhen you transport FoxPro applications between character-based and graphic- based environments, you must convert the row and column positions of screen objects appropriately, as explained below.
MORE INFORMATIONIn FoxPro for MS-DOS, objects are placed based on row and column positions. The size of each row and column remains constant, since only one screen font is available. However, in FoxPro for Windows and FoxPro for the Macintosh, row and column sizes will vary based on the current font and the current resolution of the screen. In order to provide a consistent unit of measurement and accurate placement of objects between platforms, foxels were developed. Foxels are simply fractional rows and columns, expressed in decimal form. A foxelrow is used to indicate a single vertical row of characters. A foxelcol is used to indicate a single horizontal character. The size of a foxelrow will vary depending on the height of the current font. The number of foxelrows available can be determined with the SROWS() function. The size of a foxelcol will vary depending on the average width of characters in the current font. The number of foxelcols available can be determined with the SCOLS() function. The algorithm to determine pixel-to-foxel conversion is:
FUNCTION _pix2fox PARAMETER m.apixel,m.dimension RETURN m.apixel/FONTMETRIC(IIF(UPPER(m.dimension) = "H",6,1))The following two parameters are passed to the function:
Usage
myfoxelrow = _pix2fox(pixvalnum,"V") && for vertical (row) values myfoxelcol = _pix2fox(pixvalnum,"H") && for horizontal (col) valuesThe algorithm for foxelrows divides the pixel position by the character height in pixels for the current font. The algorithm for foxelcols divides the pixel position by the average character width in pixels for the current font.
|
Additional reference words: VFoxWin 3.00 FoxMac FoxWin 2.50 2.50a 2.50b
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |