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.
SET SPACE
, Set(“Space”)These commands let you produce streaming output (as opposed to the line-oriented output of @ .. SAY). ? and ?? produce output. SET SPACE
determines whether a space is used between output items.
? | ?? [ uExpr1 [ PICTURE cMask ]
[ FUNCTION [ cCodes ] [ V nWidth ] ]
[ AT nColumn ]
[ FONT cFontName [, nFontSize ] [ STYLE cStyleCodes ] ]
[ , eExpr2 [ ... ] ] ]
SET SPACE ON | OFF
cSpaceSetting = SET("SPACE")
Parameter |
Value |
Meaning |
uExprn |
Expression |
The nth expression to print. |
cMask |
Character |
Output mask using the same codes as the InputMask property. |
cCodes |
Character |
Function codes using the same list as the Format property. |
nWidth |
Numeric |
The number of columns to devote to this item. |
nColumn |
Numeric |
Starting column for this item. |
cFontName |
Character |
Font to use for this item. |
nFontSize |
Numeric |
Font size to use for this item. |
cStyleCodes |
Character |
List of style codes to use in the specified font. |
? streams output including a carriage return and line feed, while ?? sends output without those characters. When we first learned Xbase, it took us the longest time to understand that ? sends the CR/LF pair before it prints. So, to send several items on one line followed by a new line, you use a series of ?? and then issue ?.
Over the years, ? and ?? have gotten more and more powerful, acquiring much of the functionality of @ .. SAY. We use these a lot more than @ .. SAY, though, because they’re handy for sending output to the active window when you’re testing. However, we rarely use either one in applications.
When you include several expressions in a single command, each can have its own font and position clauses. Be careful how you combine them, though, because the column you specify in the AT clause is computed based on that item’s font. It’s easy to overwrite one item with another.
??CHR(7) is the traditional way to sound the bell in FoxPro. It still works just fine with one warning. You’ll probably want to specify a small font for it because it can (eventually) make the active window scroll up. Two-point Arial works just fine. (SET BELL
controls the frequency and duration of the tone.)
By default, when you include multiple items with ? or ??, a single space appears between them. SET SPACE
OFF to run them together.
? $12345 PICTURE "999,999,999" FUNCTION "$" && displays $12,345
USE Employee
? First_Name,Last_Name && Looks good
SET SPACE OFF
? First_Name,Last_Name && Looks awful