Organisation
In its basic layout, a grid is a matrix of cells with mainly fixed cells (not editable) and normal
cells. A fixed cell will not scroll along with normal cells and thus remain visible on any of the 4
sides of the grid. This number of fixed rows and/or columns on the 4 sides of the grid is
controlled by properties: grid.FixedRows, grid.FixedColumns, grid.FixedFooterRows,
grid.FixedRightColumns. In addition to fixed, non scrolling rows and/or columns, the grid can
also perform column freezing. These are columns or rows of normals cells that will not scroll
along with the other columns or rows in the grid. The number of freeze columns and rows is set
with grid.FreezeColumns, grid.FreezeRows. Cells are accessible via
grid.Cells[Column,Row]:string and the selected cell(s) can be set with properties:
grid.Selection := MakeCellRange(StartCol,StartRow,EndCol,EndRow);
grid.FocusedCell := MakeCell(Col,Row);
The grid features several selection modes: single cell selection, single row selection, single
column selection, cell range selection, row range selection, column range selection, disjunct row
selection, disjunct cell selection and disjunct column selection. The selection mode is chosen
with the property:
grid.Options.Selection.Mode: TTMSFNCGridSelectionMode;
The scroll position in the grid can be programmatically set or retrieved via the properties
grid.LeftCol: integer, grid.TopRow: integer.
Note that scrolling in the grid can be performed in two ways: cell scrolling and pixel level
scrolling. In cell scrolling mode, the minimum quantity of a scroll is an entire column or row, in
pixel scrolling mode, scrolling is per pixel and can thus be done on sub cell level. The scrolling
mode is controlled by the property:
grid.ScrollMode = (smCellScrolling, smPixelScrolling)
When navigating through the grid, the grid will automatically scroll when selecting a cell that is
partially visible and bring it in view. When clicking and dragging the mouse outside of the grid
normal cells area, the grid will start an autoscroll operation which will scroll with a delta that is
automatically calculated based on the distance of the mouse to the last position inside the grid.
This automatic scrolling and some additional properties to control speed and interval can be set
under grid.Options.Mouse.
The size of columns & rows is controlled by grid.ColumnWidths[ColumnIndex]: single,
grid.RowHeights[RowIndex]: single and it can be configured that the user can resize columns or
rows at runtime with: grid.Options.Mouse.ColumnSizing,
grid.Options.Mouse.FixedColumnSizing, grid.Options.Mouse.RowSizing,
grid.Options.Mouse.FixedRowSizing.
The amount of displayed columns and rows are set with grid.ColumnCount: integer and
grid.RowCount: integer properties.