Sign in Join
FPDoc Onlineexperiment

TCustomGrid.FixedCols property

Member of TCustomGridprotectedIn unit Grids

The number of fixed columns in the grid.

Declaration

pascal
property FixedCols: Integer read FFixedCols write SetFixedCols default 1;

Description

FixedCols is an Integer property with the fixed column count for the grid. Fixed columns are displayed on the left edge of the grid and become part of the non-scrolled area for the control. A fixed column is displayed using the background color in FixedColor and separator lines using FixedGridLineColor. They are also rendered using the display style attributes in TitleStyle.

Values in a fixed column cannot be selected or edited using a cell editor at run-time. They can be modified, however, in descendent classes like TStringGrid by assigning values directly to the Cells property for the required column number.

The default value for the FixedCols property is 1 and causes the first column (column 0) (the one reserved for row indicators or automatic row numbering) to always be visible on the left edge of the control. Cell data in adjacent column can be converted to fixed column by incrementing the value for the property.

Setting a new value for the property causes several actions to be performed for the grid control.

  • The values in FixedCols and FixedRows are verified by calling CheckFixedCount, which can raise an exception if either value is not in range for the grid control.
  • EditorMode is set to False to hide a visible cell Editor for the control.
  • When Columns has been Enabled, UpdateSelectionRange is called to refresh the selection rectangle for the control. ColumnsChanged is called to apply the visual change to the control. If Columns has not been Enabled, MoveNextSelectable and UpdateSelectionRange are called to refresh the grid control.

Use FixedRows to get or set the number of fixed rows displayed for the grid control.

Use the Columns property to maintain column definitions for the non-fixed columns on the control. If a column definition in Columns needs to be changed to a fixed column, it must be removed from the Columns collection before increasing the value in FixedCols. An Exception is raised if FixedCols + Columns.Count does not match the value in ColCount.

See also

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