Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.
SCOLS()
, SROWS()
These two functions tell you about the size of the main Visual FoxPro window with respect to the current font. You can find similar (sometimes the same) information using the system variable _SCREEN and its properties Height and Width.
nScreenCols = SCOLS()
nScreenRows = SROWS()
The functions return the number of columns and rows available in the main window using the current font. If you change the screen font, the results change. Of course, resizing the window (whether in code or interactively) changes the results. The values returned are in foxels, FoxPro’s special unit of measure that corresponds roughly to a character. These functions are primarily included for backward compatibility with DOS applications that used to have to check for 43-line EGA screens and 50-line VGA screens.
The system variable _SCREEN is an object reference to the main window. You can both inquire about and change that window’s characteristics by referencing the variable. The Height and Width properties tell you about the size of the window. By default, those properties use pixels, which are not sensitive to font changes. However, by changing _SCREEN.ScaleMode to 0, you can see the results in foxels. In that case, Height and Width are the same as SROWS()
and SCOLS()
, respectively.
nRows=SROWS()
nCols=SCOLS()
? SROWS(),SCOLS()
_SCREEN.FontName="Courier New"
? SROWS(),SCOLS()
_SCREEN.FontSize=14
? SROWS(),SCOLS()
FontBold, FontItalic, FontMetric(), FontName, FontSize, Height, Modify Window, ScaleMode, _Screen, SysMetric(), WFont(), Width