Setting Column Properties at Design Time
Go Up to Creating a Customized Grid
Column properties determine how data is displayed in the cells of that column. Most column properties obtain their default values from properties associated with another component (called the default source) such as a grid or an associated field component.
To set the properties of a column, select the column in The Columns editor and set its properties in the Object Inspector. The following table summarizes key column properties you can set.
Column properties :
Property | Purpose |
---|---|
Alignment |
Left justifies, right justifies, or centers the field data in the column. Default source: TField.Alignment. |
ButtonStyle |
cbsAuto: (default) Displays a drop-down list if the associated field is a lookup field, or if the PickList property of the column contains data.cbsEllipsis: Displays an ellipsis (...) button to the right of the cell. Clicking on the button fires the grid's OnEditButtonClick event.cbsNone: The column uses only the normal edit control to edit data in the column. |
Color |
Specifies the background color of the cells of the column. Default source: TDBGrid.Color. (For text foreground color, see the Font property.) |
DropDownRows |
The number of lines of text displayed by the drop-down list. Default: 7. |
Expanded |
Specifies whether the column is expanded. Only applies to columns representing ADT or array fields. |
FieldName |
Specifies the field name associated with this column. This can be blank. |
ReadOnly |
True: The data in the column cannot be edited by the user.False: (default) The data in the column can be edited. |
Width |
Specifies the width of the column in screen pixels. Default source: TField.DisplayWidth. |
Font |
Specifies the font type, size, and color used to draw text in the column. Default source: TDBGrid.Font. |
PickList |
Contains a list of values to display in a drop-down list in the column. |
Title |
Sets properties for the title of the selected column. |
The following table summarizes the options you can specify for the Title property.
Expanded TColumn Title properties :
Property | Purpose |
---|---|
Alignment |
Left justifies (default), right justifies, or centers the caption text in the column title. |
Caption |
Specifies the text to display in the column title. Default source: TField.DisplayLabel. |
Color |
Specifies the background color used to draw the column title cell. Default source: TDBGrid.FixedColor. |
Font |
Specifies the font type, size, and color used to draw text in the column title. Default source: TDBGrid.TitleFont. |