[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Grids' (#lcl)

# TGridColumn

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Implements a column definition used for tabular data in TCustomGrid.

## Declaration

Source position: grids.pas line 515

`type TGridColumn = class(TCollectionItem)`
`protected`
`function GetDisplayName; override;`
`function GetDefaultAlignment; virtual;` |  | Gets the default value for the Alignment property.
`function GetDefaultColor; virtual;` |  | Gets the default value for the Color property.
`function GetDefaultLayout; virtual;` |  | Default layout used for text in the grid column.
`function GetDefaultMaxSize; virtual;` |  | Gets the default value for the MaxSize property.
`function GetDefaultMinSize; virtual;` |  | Gets the default value for the MinSize property.
`function GetDefaultReadOnly; virtual;` |  | Gets the default value for the ReadOnly property.
`function GetDefaultSizePriority;` |  | Gets the default value for the SizePriority property.
`function GetDefaultVisible; virtual;` |  | Gets the default value for the Visible property.
`function GetDefaultValueChecked; virtual;` |  | Gets the default value for a checked cell in the grid column.
`function GetDefaultValueUnchecked; virtual;` |  | Gets the default value for an unchecked cell in the column.
`function GetDefaultWidth; virtual;` |  | Gets the default value for the Width property.
`function GetPickList; virtual;` |  | Gets the list of strings in the picklist.
`function GetValueChecked;` |  | Gets the value for the ValueChecked property.
`function GetValueUnchecked;` |  | Gets the value for the ValueUnChecked property.
`procedure ColumnChanged; virtual;` |  | Performs actions needed when a column in the grid is changed.
`procedure AllColumnsChange;` |  | Method used to indicate that all columns in the collection have been changed.
`function CreateTitle; virtual;` |  | Creates a column title used for the grid column.
`procedure SetIndex(); override;` |  | Sets the value for the Index property.
`property IsDefaultFont: Boolean; [r]` |  | Indicates if the default font is in use for the grid column.
`public`
`constructor Create(); override;` |  | Constructor for the class instance.
`destructor Destroy; override;` |  | Destructor for the class instance.
`procedure Assign(); override;` |  | Copies property values from the specified persistent object to the current class instance.
`procedure FillDefaultFont;` |  | Sets the Font to the value used in the grid control.
`procedure FixDesignFontsPPI(); virtual;` |  | Corrects the design-time PPI for the column title.
`procedure ScaleFontsPPI(); virtual;` |  | Scales the fonts for the column to a specified display density using a scaling factor.
`function IsDefault; virtual;` |  | Indicates if default layout settings are used for the grid column.
`property Grid: TCustomGrid; [r]` |  | The grid control to which this column belongs.
`property DefaultWidth: Integer; [r]` |  | Default width for the column, or -1 when not assigned.
`property StoredWidth: Integer; [r]` |  | Contains the explicit, non-default value assigned to the Width property.
`property WidthChanged: Boolean; [r]` |  | True when the width for the column has been changed.
`published`
`property Alignment: TAlignment; [rws]` |  | Indicates the alignment for values displayed in the column: left or right aligned, or centered.
`property ButtonStyle: TColumnButtonStyle; [rw]` |  | The style used for a button displayed for cells in the column.
`property Color: TColor; [rws]` |  | Color for the background on the column.
`property DropDownRows: LongInt; [rw]` |  | The number of rows displayed in the drop-down list for a cell editor in the column.
`property Expanded: Boolean; [rw]` |  | Indicates if the drop-down list in the column cell editor is displayed in an expanded state.
`property Font: TFont; [rws]` |  | The font used for text displayed in the column.
`property Layout: TTextLayout; [rws]` |  | The layout (vertical alignment) for text displayed in the column.
`property MinSize: Integer; [rws]` |  | The minimum size for the column in pixels.
`property MaxSize: Integer; [rws]` |  | The maximum size for the column in pixels.
`property PickList: TStrings; [rw]` |  | The list with the values that can be selected for a cell in the column using a drop-down list.
`property ReadOnly: Boolean; [rws]` |  | True if the values in the column cannot be changed at run-time using the cell editor.
`property SizePriority: Integer; [rws]` |  | The auto-sizing priority for the column.
`property Tag: PtrInt; [rw]` |  | Contains a Pointer to an Integer type.
`property Title: TGridColumnTitle; [rw]` |  | Contains the attributes for the title in the fixed header for the column.
`property Width: Integer; [rws]` |  | The display width in pixels for the column on its Grid control.
`property Visible: Boolean; [rws]` |  | True if the column is visible (not hidden) on the Grid control.
`property ValueChecked: string; [rws]` |  | Contains the checked value for a check box in the column.
`property ValueUnchecked: string; [rws]` |  | Contains the unchecked value for a check box in the column.
`end;`

## Inheritance

`TGridColumn` |  | Implements a column definition used for tabular data in TCustomGrid.
`TCollectionItem`
?
`TObject`

## Description

TGridColumn is a TCollectionItem descendant which implements a column definition for grid controls. TGridColumn contains properties which control the appearance, layout, and editing behavior used for a column in TCustomGrid and descendent classes. For instance:

- Alignment
- ButtonStyle
- Color
- DropDownRows
- Font
- Layout
- MinSize
- MaxSize
- PickList
- ReadOnly
- Width
- Visible
- ValueChecked
- ValueUnchecked

The column has an associated TGridColumnTitle class instance in Title that defines the fixed cell header displayed for the column. As a convenience, the column includes a reference to the TCustomGrid which uses the column definition.

Instances of TGridColumn are created by and stored in the TGridColumns collection class. Use the methods in TGridColumns to create, access, and maintain the items in the collection.

## See also

TGridColumns |  | Collection used to store column definitions for a grid control.
TCustomGrid.Columns |  | Definitions for the columns displayed the grid.
TGridColumnTitle |  | Provides properties and methods need to represent a column title in a grid.