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

# TGridColumns

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

Collection used to store column definitions for a grid control.

## Declaration

Source position: grids.pas line 643

`type TGridColumns = class(TCollection)`
`protected`
`function GetOwner; override;`
`procedure Update(); override;` |  | Notifies the Grid using the collection when a column is updated.
`procedure TitleFontChanged;` |  | Performs actions needed when the title font is changed for items in the collection.
`procedure FontChanged;` |  | Performs actions needed when the Font for the grid control is changed.
`procedure RemoveColumn();` |  | Removes the specified column number from the collection.
`procedure MoveColumn(); virtual;` |  | Moves the column from the first index to the second.
`procedure ExchangeColumn();` |  | Exchanges the positions for the specified columns.
`procedure InsertColumn();` |  | Inserts a column at the specified index position.
`public`
`constructor Create();` |  | Constructor for the class instance.
`function Add;` |  | Creates a new ItemClass instance with the collection as its owner.
`procedure Clear;` |  | Clears all items in the collection.
`function ColumnByTitle();` |  | Gets the grid column in the collection with the specified title.
`function RealIndex();` |  | The actual grid index for the visible columns in the collection.
`function IndexOf();` |  | Gets the ordinal position in the collection for the specified column.
`function IsDefault;` |  | True if the columns contain default values only.
`function HasIndex();` |  | True if the specified index value is valid for the collection.
`function VisibleIndex();` |  | The visible index value for the specified column in the collection.
`property Grid: TCustomGrid; [r]` |  | The Grid which owns the collection and columns.
`property Items []: TGridColumn; default; [rw]` |  | Provides indexed access to column definitions in the collection.
`property VisibleCount: Integer; [r]` |  | The number of visible columns in the collection.
`property Enabled: Boolean; [r]` |  | Indicates if the column collection is enabled.
`end;`

## Inheritance

`TGridColumns` |  | Collection used to store column definitions for a grid control.
`TCollection`
?
`TObject`

## Description

TGridColumns is a TCollection descendant that implements a container for column definitions used in TCustomGrid and descendent classes. TGridColumns is the type used to implement the Columns in TCustomGrid.

TGridColumns is used to create, access, and maintain TGridColumn class instances representing the columns in a grid. Use the indexed Items to access a TGridColumn instance in the collection using its ordinal position.

Additional properties and methods are included in the collection that are relevant to their use with grid column definitions. A reference to the TCustomGrid which owns the collection is maintained to provide access to the properties, methods, and events in the grid.

## See also

TGridColumn |  | Implements a column definition used for tabular data in TCustomGrid.
TCustomGrid.Columns |  | Definitions for the columns displayed the grid.