TCustomGrid.GridColumnFromColumnIndex function
Gets the ordinal position in Columns for the visible column specified in ColumnIndex.
Declaration
function GridColumnFromColumnIndex(ColumnIndex: Integer): IntegerArguments
ColumnIndex | Ordinal position for the visible column to locate in the Columns collection. |
Function result
Ordinal position in Columns for the visible column in ColumnIndex.
Description
GridColumnFromColumnIndex is an
Integer function used
to get the position in Columns for the visible column represented by
ColumnIndex. It is necessary because a grid can include 0 or more fixed
columns. This is a problem because: A) the fixed columns are both optional
and variable, and B) the Columns collection uses ordinal values and never
includes a column definition for fixed column.
ColumnIndex refers to the ordinal position for a visible column in the display area for the grid control. The return value is calculated as ColumnIndex + FirstGridColumn. In previous versions of the LCL, the value was derived using values from VisibleIndex and FixedCols.
The return value is -1 if the computed value is larger than ColCount-1.
GridColumnFromColumnIndex is used when a new value is assigned to the Index property in a TGridColumn instance. It is also used in the DialogChar method to locate and perform the OnClick handler for the column header where an accelerator key is found.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
