Skip to main content

Overview

TColumns is a collection class that manages TColumn instances. It provides methods for adding, accessing, and organizing columns, and includes a Spacing property to control horizontal separation between columns.

Key Properties

TColumn
Access columns by numeric index.
TColumn
Access columns by name (header text).
This property is not available in Free Pascal (FPC).
TCoordinate
Horizontal separation between columns in pixels. Controls the gap between adjacent columns.
TColumn
Returns the parent column if this is a sub-columns collection, or nil if this is a top-level columns collection.

Key Methods

TColumn
Creates and adds a new column to the collection.
TColumn
Creates and adds a new column with the specified header text.
TColumn
Returns the column at the specified X coordinate, or nil if no column is found.
TColumn
Finds the first column with the specified name (case-insensitive search).
TColumn
Returns the first visible column in the collection.
Integer
Returns the maximum hierarchical depth of columns. Returns 1 for flat columns, 2 if any column has sub-columns, etc.
Boolean
Returns true if column spacing is greater than zero.

Events

TColumnMovedEvent
Event triggered when a column is moved from one position to another.

Usage Examples

Adding Columns

Accessing Columns

Hierarchical Columns

Finding Columns

Column Spacing

Design-Time Support

The TColumns class includes internal support for design-time column editing through the OnGetFields and OnSetField events. These are used by the IDE’s column editor dialog.