TTMSFNCDataGridCore Class
Core geometry and layout engine shared by all TMS FNC DataGrid platform variants (FMX, VCL, WEB).
API unit family: TMSFNCDataGridCore
Inherits from: TInterfacedPersistent
Implements: ITMSFNCPersistence
Syntax
TTMSFNCDataGridCore = class(TInterfacedPersistent, ITMSFNCPersistence)
Remarks
Manages row/column counts, widths, heights, fixed and freeze bands, hidden state, merge state, reorder dictionaries, and cumulative position caches. TTMSFNCDataGridRenderer owns an instance of this class and delegates all layout queries to it. Do not instantiate directly — drop a TTMSFNCDataGrid on a form and access geometry through its Root property when needed.
Properties
| Name | Description |
|---|---|
| ColumnCount | Total number of columns in the grid, including fixed columns. Default is 4. |
| ColumnOrderDictionary | Serialised column display-order map. Used internally by the persistence layer; do not modify directly. |
| ColumnOrders | Display-order index for the given physical column. Reflects user drag-and-drop reordering. |
| ColumnPositionDictionary | Serialised column pixel-position map. Used internally by the persistence layer; do not modify directly. |
| ColumnPositions | Pixel position (left edge) of the column in the scrollable content area. |
| ColumnReverseOrderDictionary | Serialised reverse column-order map. Used internally by the persistence layer; do not modify directly. |
| ColumnReverseOrders | Physical column index for the given display-order index. Inverse of ColumnOrders. |
| ColumnViewMode | Controls whether ColumnCount reflects total allocated columns (gcvmTotalColumns) or only the columns that fit in the control viewport (gcvmControl). |
| ColumnWidthDictionary | Serialised column-width map. Used internally by the persistence layer; do not modify directly. |
| ColumnWidths | Width of the column in logical pixels. Setting this triggers a layout recalculation. |
| ColumnWidthsDIP | Width of the column in device-independent pixels (DIP). Use this for DPI-aware layout code. |
| DefaultColumnWidth | Default width applied to columns that have no explicit width set. Leave at 0 to use the platform default. |
| DefaultRowHeight | Default height applied to rows that have no explicit height set. Leave at 0 to use the platform default. |
| FilteredRowCount | Number of rows currently excluded by an active filter. |
| FilteredRowDictionary | Serialised filter-state map. Used internally by the persistence layer; do not modify directly. |
| FilteredRows | Gets or sets whether the row is excluded from the display by the active filter. |
| FixedBottomRowCount | Number of non-scrolling rows pinned to the bottom edge of the grid. Default is 0. |
| FixedColumnCount | Number of non-scrolling columns pinned to the left edge of the grid (typically used for row headers). Default is 0. |
| FixedRightColumnCount | Number of non-scrolling columns pinned to the right edge of the grid. Default is 0. |
| FixedRowCount | Number of non-scrolling rows pinned to the top edge of the grid (typically used for column headers). Default is 1. |
| FreezeColumnCount | Number of columns that scroll with the grid but remain visible on screen (freeze pane). Freeze columns appear immediately to the right of the fixed columns. Default is 0. |
| FreezeRowCount | Number of rows that scroll with the grid but remain visible on screen (freeze pane). Freeze rows appear immediately below the fixed rows. Default is 0. |
| HasRowOrder | Returns True when the row has a custom display order assigned. |
| Height | Height of the grid control in logical pixels. |
| HiddenColumnCount | Number of columns currently hidden. |
| HiddenColumnDictionary | Serialised hidden-column map. Used internally by the persistence layer; do not modify directly. |
| HiddenColumnWidths | Stored width of a hidden column, preserved so it can be restored when unhidden. |
| HiddenColumns | Gets or sets the hidden state of a column. Setting to True is equivalent to calling HideColumn. |
| HiddenRowCount | Number of rows currently hidden. |
| HiddenRowDictionary | Serialised hidden-row map. Used internally by the persistence layer; do not modify directly. |
| HiddenRowHeights | Stored height of a hidden row, preserved so it can be restored when unhidden. |
| HiddenRows | Gets or sets the hidden state of a row. Setting to True is equivalent to calling HideRow. |
| IsExporting | True while an export operation is in progress. |
| MergedColumnDictionary | Serialised merged-column map. Used internally by the persistence layer; do not modify directly. |
| MergedColumns | Gets or sets whether a column participates in a merged header span. |
| MergedRowDictionary | Serialised merged-row map. Used internally by the persistence layer; do not modify directly. |
| MergedRows | Gets or sets whether a row participates in a merged row span. |
| Name | Identifier used when serialising this core instance. |
| RowCount | Total number of rows in the grid, including fixed rows. Default is 24. |
| RowHeightDictionary | Serialised row-height map. Used internally by the persistence layer; do not modify directly. |
| RowHeights | Height of the row in logical pixels. Setting this triggers a layout recalculation. |
| RowHeightsDIP | Height of the row in device-independent pixels (DIP). |
| RowOrderDictionary | Serialised row display-order map. Used internally by the persistence layer; do not modify directly. |
| RowOrders | Display-order index for the given physical row. |
| RowPositionDictionary | Serialised row pixel-position map. Used internally by the persistence layer; do not modify directly. |
| RowPositions | Pixel position (top edge) of the row in the scrollable content area. |
| RowReverseOrderDictionary | Serialised reverse row-order map. Used internally by the persistence layer; do not modify directly. |
| RowReverseOrders | Physical row index for the given display-order index. Inverse of RowOrders. |
| RowViewMode | Controls whether RowCount reflects total allocated rows (grvmTotalRows) or only the rows that fit in the control viewport (grvmControl). |
| StartColumn | Index of the first column currently visible in the viewport (leftmost scrolled-to column). |
| StartRow | Index of the first row currently visible in the viewport (topmost scrolled-to row). |
| StopColumn | Index of the last column currently visible in the viewport. |
| StopRow | Index of the last row currently visible in the viewport. |
| TotalColumnOffset | Horizontal scroll offset applied to the content area, in logical pixels. |
| TotalColumnWidth | Sum of all column widths (excluding hidden columns) in logical pixels. |
| TotalFixedBottomRowHeight | Combined height of all fixed bottom rows in logical pixels. |
| TotalFixedColumnWidth | Combined width of all fixed left columns in logical pixels. |
| TotalFixedRightColumnWidth | Combined width of all fixed right columns in logical pixels. |
| TotalFixedRowHeight | Combined height of all fixed top rows in logical pixels. |
| TotalRowHeight | Sum of all row heights (excluding hidden rows) in logical pixels. |
| TotalRowOffset | Vertical scroll offset applied to the content area, in logical pixels. |
| UndoManager | The undo/redo manager for this grid. Attach actions here to support Ctrl+Z / Ctrl+Y. |
| UpdateCount | Current nesting depth of BeginUpdate calls. Positive values mean updates are suspended. |
| VisibleColumnCount | Number of columns currently visible in the viewport (excludes hidden and out-of-range columns). |
| VisibleRowCount | Number of rows currently visible in the viewport (excludes hidden and filtered rows). |
| Width | Width of the grid control in logical pixels. |
Methods
| Name | Description |
|---|---|
| AfterExport | Called after an export operation finishes. |
| BeforeExport | Called before an export operation starts. |
| BeginUpdate | Suspends layout recalculation and repainting until the matching EndUpdate call. |
| CanLoadProperty | Returns True when the named property can be loaded during persistence. |
| CanSaveProperty | Returns True when the named property can be saved during persistence. |
| Clear | Resets all cell data and row/column metadata. Equivalent to starting with a blank grid. |
| ClearColumnInfo | Clears geometry metadata (width, position, order, hidden state) for the specified column, or for all columns when AColumn is -1. |
| ClearRowInfo | Clears geometry metadata (height, position, order, hidden state) for the specified row, or for all rows when ARow is -1. |
| DisplayToRealCell | Converts a display-order cell coordinate to the underlying physical storage coordinate. |
| DisplayToRealColumn | Converts a display-order column index to its physical storage index. |
| DisplayToRealRow | Converts a display-order row index to its physical storage index. |
| DoNotifyEditor | Notifies attached editors that grid structure or data changed. |
| EndUpdate | Resumes layout recalculation and triggers a full repaint after a BeginUpdate block. |
| ExportNotification | Called during export to report progress. Override or handle OnExportNotification to track export state. |
| GetLocalRect | Returns the current layout rectangle of the grid control. |
| GetTotalFixedBottomRowHeight | Returns the total pixel height occupied by fixed bottom rows. |
| GetTotalFixedColumnWidth | Returns the combined width of all fixed left columns, optionally including freeze columns. |
| GetTotalFixedRightColumnWidth | Returns the combined width of all fixed right columns. |
| GetTotalFixedRowHeight | Returns the combined height of all fixed top rows, optionally including freeze rows. |
| HideColumn | Hides the specified column and triggers a layout update. |
| HideRow | Hides the specified row and triggers a layout update. |
| ImportNotification | Called during import to report progress. |
| IsAppearanceProperty | Returns True when the named property belongs to the appearance persistence surface. |
| IsCellDisabled | Returns True when the cell is disabled (not editable and not interactive). |
| IsCellDisplayed | Returns True when the cell is part of the current displayed data view. |
| IsCellFixed | Returns True when the cell belongs to any fixed band (fixed top/bottom row or fixed left/right column). |
| IsCellFixedColumn | Returns True when the cell is in a fixed left or right column. |
| IsCellFixedRoot | Returns True when the cell is in the top-left corner intersection of fixed rows and columns. |
| IsCellFixedRow | Returns True when the cell is in a fixed top or bottom row. |
| IsCellFreeze | Returns True when the cell is in any frozen row or column. |
| IsCellFreezeColumn | Returns True when the cell is in a frozen column. |
| IsCellFreezeFixed | Returns True when the cell is in a freeze band that also intersects a fixed band. |
| IsCellFreezeRoot | Returns True when the cell is at the freeze/fixed intersection corner. |
| IsCellFreezeRow | Returns True when the cell is in a frozen row (scrolls with the grid but stays on screen). |
| IsCellValid | Returns True when the cell's column and row indices are within the current grid bounds. |
| IsCellVisible | Returns True when the cell currently falls within the visible (rendered) range of the grid. |
| IsColumnDisplayed | Returns True when the column is part of the current displayed data view. |
| IsColumnFixed | Returns True when the column is a fixed left or right column. |
| IsColumnFreeze | Returns True when the column is a freeze column. |
| IsColumnHidden | Returns True when the column has been hidden via HideColumn or HiddenColumns[]. |
| IsColumnMerged | Returns True when the column spans into the next column (merged header). |
| IsColumnValid | Returns True when AColumn is within 0 and ColumnCount - 1. |
| IsColumnVisible | Returns True when the column is not hidden and within the visible range. |
| IsRowDisplayed | Returns True when the row is part of the current displayed data view. |
| IsRowFiltered | Returns True when the row has been excluded by an active filter. |
| IsRowFixed | Returns True when the row is a fixed top or bottom row. |
| IsRowFreeze | Returns True when the row is a freeze row. |
| IsRowHidden | Returns True when the row has been hidden via HideRow or HiddenRows[]. |
| IsRowMerged | Returns True when the row spans into the next row (merged row). |
| IsRowValid | Returns True when ARow is within 0 and RowCount - 1. |
| IsRowVisible | Returns True when the row is not hidden and within the visible range. |
| LoadSettingsFromFile | Loads previously saved grid settings (column widths, row heights, appearance) from a file. |
| LoadSettingsFromStream | Loads previously saved grid settings from a stream. |
| LogMessage | Emits a diagnostic message via OnLogMessage. |
| LoopThroughColumns | Iterates every column and invokes with the column index. |
| LoopThroughRows | Iterates every row and invokes with the row index. |
| RealToDisplayCell | Converts a physical storage cell coordinate to the current display-order coordinate. |
| RealToDisplayColumn | Converts a physical storage column index to its current display-order index. |
| RealToDisplayRow | Converts a physical storage row index to its current display-order index. |
| RealToVisualColumn | Converts a physical storage column index to the 0-based column index in the currently rendered output (reorder applied, and hidden columns skipped). Returns -1 when the column is hidden. |
| RealToVisualRow | Converts a physical storage row index to the 0-based row index in the currently rendered output (sort applied, and filtered/hidden rows skipped). Returns -1 when the row is filtered or hidden. |
| SaveSettingsToFile | Saves grid settings (column widths, row heights, appearance) to a file for later restoration via LoadSettingsFromFile. |
| SaveSettingsToStream | Saves grid settings to a stream. |
| StretchColumns | Redistributes column widths to fill the available control width. |
| StretchRows | Redistributes row heights to fill the available control height. |
| UnhideAll | Makes all hidden rows and columns visible again. |
| UnhideAllColumns | Makes all hidden columns visible again. |
| UnhideAllRows | Makes all hidden rows visible again. |
| UnhideColumn | Makes the specified column visible if it was hidden. |
| UnhideRow | Makes the specified row visible if it was hidden. |
| Update | Forces a full layout recalculation and repaint of the grid. |
| UpdateColumnRowCalculations | Recalculates cumulative row/column positions and fixed-band totals. Called automatically after structural changes. |
| UpdateVisualRange | Recalculates which rows and columns fall within the current viewport. Called after scrolling or resizing. |
| VisualToRealColumn | Converts a 0-based column index in the currently rendered output (reorder + hidden applied) back to the physical storage column index. Fixed left/right columns map through unchanged. |
| VisualToRealRow | Converts a 0-based row index in the currently rendered output (sort + filter applied) back to the physical storage row index. Fixed top/bottom rows map through unchanged. |
Events
| Name | Description |
|---|---|
| OnCanLoadProperty | Fired during DFM loading for each persisted property. Return False in the handler to skip loading a specific property. |
| OnCanSaveProperty | Fired during DFM saving for each property. Return False in the handler to exclude a specific property from persistence. |
| OnLogMessage | Fires whenever the grid logs a diagnostic message. Assign this to route messages to your own log sink. |
| OnNotifyEditor | Internal event forwarded to the active in-place editor to notify it of structural changes. Not intended for application use. |