Architecture
The DataGrid is built as three layers stacked on top of each other. Knowing which layer owns which job makes it easy to find APIs, write custom cells, and reason about performance.
The three layers
┌─────────────────────────────────────────┐
│ TTMSFNCDataGridRenderer │ ← drawing, layout, controls
│ ┌─────────────────────────────────┐ │
│ │ TTMSFNCDataGridData │ │ ← data, sort/filter/group
│ │ ┌─────────────────────────┐ │ │
│ │ │ TTMSFNCDataGridCore │ │ │ ← geometry, coordinates
│ │ └─────────────────────────┘ │ │
│ └─────────────────────────────────┘ │
└─────────────────────────────────────────┘
| Layer | Class | Responsibility |
|---|---|---|
| Geometry | TTMSFNCDataGridCore |
Column and row counts, fixed/freeze regions, cell coordinates, dimensions. |
| Data | TTMSFNCDataGridData |
Cell values (TValue-based), formatting, sorting, filtering, grouping, calculations. |
| Drawing | TTMSFNCDataGridRenderer |
Layout calculation, cell painting, embedded controls, scrolling, selection visuals. |
The user-facing component, TTMSFNCDataGrid, wraps a root instance of TTMSFNCDataGridRenderer and exposes its API. When you embed a sub-grid in a cell (see Cell controls), a fresh TTMSFNCDataGridRenderer is created — so the same three-layer stack applies inside the nested grid too.
Why three layers?
The split lets each layer be reused without dragging the others along:
- Headless processing — the data layer can sort, filter, and group without ever drawing.
- Custom rendering — the drawing layer can be subclassed without touching how data is stored.
- Cross-platform —
TTMSFNCDataGridCorehas no FMX, VCL, or Web dependencies, so the same coordinate system works everywhere.
Where to subclass
| If you want to… | Subclass / override |
|---|---|
| Change how a cell is painted | TTMSFNCDataGridCell (see Custom cells) |
| Change how a cell is laid out | Hook OnGetCellLayout (see Appearance & theming) |
| Change how data is converted to display text | Hook OnGetCellFormatting (see Data, formatting & conversion) |
| Add a custom column type | Subclass TTMSFNCDataGridColumn |
| Build a master-detail UI | Use two adapter pairs (see Master-detail) |
See also
- Cells, columns & coordinates — how the geometry layer addresses cells.
- Layout priority — how the drawing layer resolves cell appearance.
- Data, formatting & conversion — how the data layer stores and renders values.