peTextAlignment - cCJGridColumn

Specifies the text alignment for text displayed in the column

Type: Property

Access: Read/Write

Data Type: XTPColumnAlignment

Parameters: None

Syntax
 Property XTPColumnAlignment peTextAlignment

Read Access: Get peTextAlignment to XTPColumnAlignmentVariable
Write Access: Set peTextAlignment to XTPColumnAlignmentVariable/Value


Description

Valid values are:

ConstantMeaning
xtpAlignmentDefaultAlign according to the column default
xtpAlignmentLeftLeft aligns the caption (default)
xtpAlignmentCenterCenters the caption
xtpAlignmentRightRight aligns the caption
xtpAlignmentVCenterVertically centers the caption


Vertical Alignment and Multi-Row Headers

Each of the Left, Center or Right alignment constants can be combined with the VCenter alignment constant. For example:

Set peTextAlignment to (xtpAlignmentLeft + xtpAlignmentVCenter)

The VCenter constant ensures that single line header text is vertically centered in the case where a grid row height spans multiple lines (see pbMultiLine).

If the grid's pbUseColumnTextAlignment is set to True, then setting peTextAlignment also affects the default alignment of text displayed in the column header and column footer. To align header text differently from the column cell text set the peHeaderAlignment and peFooterAlignment properties accordingly.

Detecting Changes in Source Layout

When source code changes are made in a grid, the restored layout may interfere with those changes. When this happens, changes made to the grid and its columns will not appear because the old settings are being restored. The grid class attempts to recognize when such a change has occurred by checking if the number of columns has changed. If it has, the previous setting will not be restored. This only catches a small number of the possible changes and it is quite likely that it will not recognize that a change has actually occurred. When this occurs, it will appear that the grid is ignoring your source code changes. The number of columns that appear may be wrong, the ordering and size of the columns may be wrong and some of the grid alignment settings will be wrong.

If this happens, you must tell the system that the menu layout has changed. You can do this by changing (i.e., incrementing) the build number of the grid system by setting the piLayoutBuild property.

During development, it is probably best to disable the loading and saving of the grid's environment. Set pbRestoreLayout of the grid object to False to turn off restore layout for a grid, or set pbPreserveEnvironment of the cApplication object to False to disable restore layout for your entire application.

If you select a numeric data type by setting peDataType to Mask_Numeric_Window, Mask_Currency_Window or 0..8, the column's text alignment will default to right instead of left. If you explicitly set peTextAlignment, that explicit setting takes precedence.

Cell Display Formatting


If you want to dynamically change the text alignment of a grid column (and other cell display formatting), do so in OnSetDisplayMetrics using ComColumnAlignment.

See Also

peIconAlignment