Sign in Join
FPDoc Onlineexperiment

TGridColumns.ExchangeColumn procedure

Member of TGridColumnsprotectedIn unit Grids

Exchanges the positions for the specified columns.

Declaration

pascal
procedure 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

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.