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.
The first six of these properties let you control the font characteristics of individual cells in a column of a grid. Like the dynamic color properties, these are very cool. The last two properties don’t do anything in VFP/Windows, but can be used in VFP/Mac.
colColumn.DynamicFontBold = cBoldExpression
cBoldExpression = colColumn.DynamicFontBold
colColumn.DynamicFontItalic = cItalicExpression
cItalicExpression = colColumn.DynamicFontItalic
colColumn.DynamicFontName = cNameExpression
cNameExpression = colColumn.DynamicFontName
colColumn.DynamicFontSize = cSizeExpression
cSizeExpression = colColumn.DynamicFontSize
colColumn.DynamicFontStrikeThru = cStrikeThruExpression
cStrikeThruExpression = colColumn.DynamicFontStrikeThru
colColumn.DynamicFontUnderline = cUnderlineExpression
cUnderlineExpression = colColumn.DynamicFontUnderline
Each of these properties accepts a character expression that evaluates to a legal value of the font property in question. That is, the expressions for DynamicFontBold, DynamicItalic, DynamicFontStrikeThru and DynamicFontUnderline should evaluate to logical values, while the expression for DynamicFontName should result in a character value (a font name) and for DynamicFontSize, the expression should yield numeric results.
The key, though, is that the value of the DynamicWhatever properties is the character expression itself. It shouldn’t be evaluated until the form is actually executing.
Most of the time, the expressions involve IIF()
and values in the table the grid is based on. Of course, you can use anything at all and can do really weird stuff if you choose. You’re limited only by your imagination, which, judging by FoxPro programmers we know, is a really scary thing.
* In the grid described under DynamicBackColor, imagine that we
* want to highlight expensive products. We'll set some columns
* to use italics for any product with a unit_price of
* more than $50.
* For each column you want italicized, set it with this
* expression, assuming This represents the grid:
This.DynamicFontItalic = "IIF(Product.Unit_Price>50,.T.,.F.)
DynamicFontOutline and DynamicFontShadow don’t do anything in Visual FoxPro for Windows, since it doesn’t support outline and shadow fonts (and that’s because Windows doesn’t support them). These two do work in Visual FoxPro for Mac.
AFont(), DynamicAlignment, DynamicBackColor, DynamicForeColor, DynamicInputMask, FontBold, FontItalic, FontName, FontOutline, FontShadow, FontSize, FontStrikeThru, FontUnderline