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

TGridColumns.ExchangeColumn

Exchanges the positions for the specified columns.

Declaration

Source position: grids.pas line 657

protected procedure TGridColumns.ExchangeColumn(

  Index: Integer;

  WithIndex: Integer

);

Arguments

Index

  

Position of a column exchanged in the method.

WithIndex

  

Position of the other column exchanged in the method.

Description

ExchangeColumn is a method used to swap the positions for the grid columns specified in the Index and WithIndex parameters. The arguments contain the ordinal positions for the respective grid columns in Items that are swapped in the method.

ExchangeColumn calls HasIndex to ensure that both values within the range allowed (0..Count-1). An exception is raised if either value is not in the required range for the column collection.

The order for the index positions is not significant; the column with the larger of the two index values is updated first. This prevents an exception from being raised when the column positions are swapped.

ExchangeColumn swaps the values for the Index properties for the corresponding TGridColumn instances in Items. The Grid control associated with the collection is notified when the Index properties are updated, and the grid moves the content for the updated columns.

Errors

Raises an Exception if values in Index or WithIndex are not within the range allowed for the collection.

See also

TGridColumns.Items

  

Provides indexed access to column definitions in the collection.

TGridColumns.Grid

  

The Grid which owns the collection and columns.

TGridColumn

  

Implements a column definition used for tabular data in TCustomGrid.

TCustomGrid

  

Implements the base class for grid controls.

TCollectionItem.Index


Version 4.0 Generated 2025-05-03 Home