Logo

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.

DynamicAlignment

This column property determines how contained controls should be aligned.

Usage

grcColumn.DynamicAlignment = cExpression
cExpression = grcColumn.DynamicAlignment

By supplying a character expression to the DynamicAlignment property, the contents of displayed cells can be aligned to the right, center or left of a column within a grid based on their content or other runtime conditions. This property could be used in combination with the DynamicColor properties to make unusual or out-of-bounds values stand out from the remainder of the display. DynamicAlignment is different from plain ol’ Alignment in that it is evaluated individually for each cell in the column, so that cells meeting certain criteria can be differentiated from all the other cells in that column—Alignment applies to all the cells in a column.

Sometimes DynamicAlignment is too dynamic. When moving up or down a column of cells where alignment changes from cell to cell (particularly if Sparse if .F.), the current cell can occasionally be seen to "jump" to one of the other alignments when the cursor key is pressed to move into a cell with different alignment. We suspect that the DynamicAlignment is being evaluated for the cell about to receive the focus, but inadvertently is applied to the current cell. As soon as the new cell receives the focus, the older cell is redrawn correctly, but the momentary wiggle is distracting. We've seen similar problems with simple, non-dynamic Alignment as well—see that section for details.

Example

grcColumn.DynamicAlignment = "iif(nValue<nThreshold,0,1)"

See Also

Alignment, Column, DynamicBackColor, DynamicForeColor, Grid