TTMSFNCDataGridCore Class
Geometry and layout engine at the root of the data grid class hierarchy.
API unit family: TMSFNCDataGridCore
Inherits from: TInterfacedPersistent
Implements: ITMSFNCPersistence
Syntax
TTMSFNCDataGridCore = class(TInterfacedPersistent, ITMSFNCPersistence)
class PASCALIMPLEMENTATION TTMSFNCDataGridCore : public System::Classes::TInterfacedPersistent, public ITMSFNCPersistence
Remarks
Manages row and column counts, default and custom widths/heights, fixed and freeze bands, hidden, filtered and merged flags, display order (reordering), cached positions, and the visible range (StartColumn..StopColumn, StartRow..StopRow). Per-row and per-column state is stored sparsely in dictionaries: only values that differ from the default are kept.
The data layer (TTMSFNCDataGridData) and the renderer (TTMSFNCDataGridRenderer) descend from this class, so every member documented here is available on the renderer returned by the grid's Root property, and most are re-exposed on TTMSFNCDataGrid itself. Do not instantiate this class directly.
Use DisplayToRealRow, RealToDisplayRow, RealToVisualRow and their column counterparts to convert between physical (storage), display-order (after reordering/sorting) and on-screen (hidden/filtered rows skipped) positions.
Properties
| Name | Description |
|---|---|
| ColumnCount | Total number of columns, fixed columns included. Default is 4. |
| ColumnOrderDictionary | Serialised column display-order map. Used internally by the persistence layer; do not modify directly. |
| ColumnOrders | Display-order position of a physical column; reflects column reordering. |
| ColumnPositionDictionary | Serialised column pixel-position map. Used internally by the persistence layer; do not modify directly. |
| ColumnPositions | Unscrolled horizontal offset of the column's left edge, measured from the left edge of column 0. |
| ColumnReverseOrderDictionary | Serialised reverse column-order map. Used internally by the persistence layer; do not modify directly. |
| ColumnReverseOrders | Physical (storage) column at a display-order position; the inverse of ColumnOrders. |
| ColumnViewMode | Determines whether the horizontal content area ends after the last column (gcvmTotalColumns, default) or spans the full control width (gcvmControl). |
| ColumnWidthDictionary | Serialised column-width map. Used internally by the persistence layer; do not modify directly. |
| ColumnWidths | Width of a column in pixels. |
| ColumnWidthsDIP | Width of a column in device-independent pixels. |
| DefaultColumnWidth | Width, in pixels, of every column that has no custom width. Default is 75. |
| DefaultRowHeight | Height, in pixels, of every row that has no custom height. Default is 30. |
| FilteredRowCount | Number of rows that are not filtered out, including fixed rows. |
| FilteredRowDictionary | Serialised filter-state map. Used internally by the persistence layer; do not modify directly. |
| FilteredRows | Filter flag of a row: True when the row is filtered out and therefore not shown. |
| FixedBottomRowCount | Number of non-scrolling rows at the bottom of the grid, typically used for totals or summaries. Default is 0. |
| FixedColumnCount | Number of non-scrolling columns at the left edge of the grid, typically used for row headers. Default is 0. |
| FixedRightColumnCount | Number of non-scrolling columns at the right edge of the grid. Default is 0. |
| FixedRowCount | Number of non-scrolling rows at the top of the grid, typically used for column headers. Default is 1. |
| FreezeColumnCount | Number of data columns, directly after the fixed left columns, that stay in view while the other columns scroll horizontally. Default is 0. |
| FreezeRowCount | Number of data rows, directly below the fixed top rows, that stay in view while the other rows scroll vertically. Default is 0. |
| HasRowOrder | True when a display-order mapping is stored for the physical row. |
| Height | Height of the layout rectangle of the grid, in pixels. |
| HiddenColumnCount | Number of columns that are currently hidden. |
| HiddenColumnDictionary | Serialised hidden-column map. Used internally by the persistence layer; do not modify directly. |
| HiddenColumnWidths | Width a column has when it is shown: its custom width, or DefaultColumnWidth when none is set. |
| HiddenColumns | Explicit hidden flag of a column. |
| HiddenRowCount | Number of rows that are not shown, either explicitly hidden or filtered out. |
| HiddenRowDictionary | Serialised hidden-row map. Used internally by the persistence layer; do not modify directly. |
| HiddenRowHeights | Height a row has when it is shown: its custom height, or DefaultRowHeight when none is set. |
| HiddenRows | Explicit hidden flag of a row. |
| IsExporting | True between BeforeExport and AfterExport, while an export is in progress. |
| MergedColumnDictionary | Serialised merged-column map. Used internally by the persistence layer; do not modify directly. |
| MergedColumns | Merged flag of a column. |
| MergedRowDictionary | Serialised merged-row map. Used internally by the persistence layer; do not modify directly. |
| MergedRows | Merged flag of a row. |
| Name | Name of this instance; the grid control names its renderer 'Root'. |
| RowCount | Total number of rows, fixed top and bottom rows included. Default is 24. |
| RowHeightDictionary | Serialised row-height map. Used internally by the persistence layer; do not modify directly. |
| RowHeights | Height of a row in pixels. |
| RowHeightsDIP | Height of a row in device-independent pixels. |
| RowOrderDictionary | Serialised row display-order map. Used internally by the persistence layer; do not modify directly. |
| RowOrders | Display-order position of a physical row; reflects row reordering and sorting. |
| RowPositionDictionary | Serialised row pixel-position map. Used internally by the persistence layer; do not modify directly. |
| RowPositions | Unscrolled vertical offset of the row's top edge, measured from the top of row 0. |
| RowReverseOrderDictionary | Serialised reverse row-order map. Used internally by the persistence layer; do not modify directly. |
| RowReverseOrders | Physical (storage) row at a display-order position; the inverse of RowOrders. |
| RowViewMode | Determines whether the vertical content area ends after the last row (grvmTotalRows, default) or spans the full control height (grvmControl). |
| StartColumn | First scrollable (non-fixed, non-freeze) column that is at least partly in view. |
| StartRow | First scrollable (non-fixed, non-freeze) row that is at least partly in view. |
| StopColumn | Last scrollable column that is at least partly in view. |
| StopRow | Last scrollable row that is at least partly in view. |
| TotalColumnOffset | Horizontal layout offset of StartColumn: the combined width of the fixed and freeze columns plus the unscrolled offset of StartColumn within the scrollable columns. |
| TotalColumnWidth | Total width of all shown columns in pixels, fixed columns included and hidden columns excluded. |
| TotalFixedBottomRowHeight | Combined height of the fixed bottom rows in pixels, as calculated by the last layout pass. |
| TotalFixedColumnWidth | Combined width of the fixed left columns and the freeze columns in pixels, as calculated by the last layout pass. |
| TotalFixedRightColumnWidth | Combined width of the fixed right columns in pixels, as calculated by the last layout pass. |
| TotalFixedRowHeight | Combined height of the fixed top rows and the freeze rows in pixels, as calculated by the last layout pass. |
| TotalRowHeight | Total height of all shown rows in pixels, fixed rows included and hidden or filtered rows excluded. |
| TotalRowOffset | Vertical layout offset of StartRow: the combined height of the fixed and freeze rows plus the unscrolled offset of StartRow within the scrollable rows. |
| UndoManager | Undo/redo manager associated with the grid. |
| UpdateCount | Current nesting depth of BeginUpdate calls; while above zero, layout recalculation is suspended. |
| VisibleColumnCount | Number of column slots in the viewport: the columns from StartColumn to StopColumn plus the fixed left, fixed right and freeze columns. |
| VisibleRowCount | Number of row slots in the viewport: the rows from StartRow to StopRow plus the fixed top, fixed bottom and freeze rows. |
| Width | Width of the layout rectangle of the grid, in pixels. |
Methods
| Name | Description |
|---|---|
| AfterExport | Ends export mode: restores the control rectangle saved by BeforeExport and recalculates the layout. |
| BeforeExport | Enters export mode: saves the current control rectangle, sets IsExporting and recalculates the layout. |
| BeginUpdate | Suspends layout recalculation until the matching EndUpdate call. |
| CanLoadProperty | Decides whether a property is read when settings are loaded through the persistence interface. |
| CanSaveProperty | Decides whether a property is written when settings are saved through the persistence interface. |
| Clear | Resets the per-row and per-column state to the defaults. |
| ClearColumnInfo | Removes the stored per-column state (custom width, cached position, display order, merged and hidden flags) of one column or of all columns. |
| ClearRowInfo | Removes the stored per-row state (custom height, cached position, display order, merged, filtered and hidden flags) of one row or of all rows. |
| DisplayToRealCell | Converts a display-order cell coordinate to the 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 | Fires OnNotifyEditor so an attached design-time columns editor can refresh. |
| EndUpdate | Ends an update block started with BeginUpdate. |
| ExportNotification | Reports the progress of an export operation to the grid. |
| GetIsDestroying | Returns True while the owning control is being destroyed. |
| GetIsLoading | Returns True while the owning control is being loaded from a form file. |
| GetLocalRect | Returns the layout rectangle last assigned to the core by its host control. |
| GetTotalFixedBottomRowHeight | Calculates the combined height of the fixed bottom rows. |
| GetTotalFixedColumnWidth | Calculates the combined width of the fixed left columns, optionally including the freeze columns. |
| GetTotalFixedRightColumnWidth | Calculates the combined width of the fixed right columns. |
| GetTotalFixedRowHeight | Calculates the combined height of the fixed top rows, optionally including the freeze rows. |
| HideColumn | Hides a column. |
| HideRow | Hides a row. |
| ImportNotification | Reports the progress of an import operation to the grid. |
| IsAppearanceProperty | Decides whether a property is part of the appearance settings saved by an appearance-only save. |
| IsCellDisabled | Returns True when the cell cannot be interacted with as a normal data cell. |
| IsCellDisplayed | Returns True when the cell is rendered as part of the current data view. |
| IsCellFixed | Returns True when the cell lies in any fixed band: a fixed top or bottom row, or a fixed left or right column. |
| IsCellFixedColumn | Returns True when the cell lies in a fixed left or right column. |
| IsCellFixedRoot | Returns True when the cell lies in one of the four corner areas where fixed columns and fixed rows intersect. |
| IsCellFixedRow | Returns True when the cell lies in a fixed top or bottom row. |
| IsCellFreeze | Returns True when the cell lies in a freeze column or freeze row, outside the fixed bands at the top and left. |
| IsCellFreezeColumn | Returns True when the cell lies in a freeze column, which stays in view while the other data columns scroll horizontally. |
| IsCellFreezeFixed | Returns True when the cell lies where a freeze band crosses a fixed band. |
| IsCellFreezeRoot | Returns True when the cell lies where the freeze columns and freeze rows intersect. |
| IsCellFreezeRow | Returns True when the cell lies in a freeze row, which stays in view while the other data rows scroll vertically. |
| IsCellValid | Returns True when the cell's column and row indexes are within the current grid bounds. |
| IsCellVisible | Returns True when the cell is currently on screen, that is, both its row and its column are visible. |
| IsColumnDisplayed | Returns True when the column is part of the displayed data view. |
| IsColumnFixed | Returns True when the column is a fixed left or fixed right column. |
| IsColumnFreeze | Returns True when the column is a freeze column (stays in view during horizontal scrolling). |
| IsColumnHidden | Returns True when the column is hidden. |
| IsColumnMerged | Returns True when the column is flagged as merged. |
| IsColumnValid | Returns True when is between 0 and ColumnCount - 1. |
| IsColumnVisible | Returns True when the column is displayed and currently on screen. |
| IsRowDisplayed | Returns True when the row is part of the displayed data view. |
| IsRowFiltered | Returns True when the row is flagged as filtered out. |
| IsRowFixed | Returns True when the row is a fixed top or fixed bottom row. |
| IsRowFreeze | Returns True when the row is a freeze row (stays in view during vertical scrolling). |
| IsRowHidden | Returns True when the row is not shown, either because it was hidden or because it is filtered out. |
| IsRowMerged | Returns True when the row is flagged as merged. |
| IsRowValid | Returns True when is between 0 and RowCount - 1. |
| IsRowVisible | Returns True when the row is displayed and currently on screen. |
| LoadSettingsFromFile | Restores grid settings from a file written by SaveSettingsToFile. |
| LoadSettingsFromStream | Restores grid settings from a stream written by SaveSettingsToStream. |
| LogMessage | Emits a diagnostic message. |
| 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 its position among the columns actually rendered (display order applied, hidden columns skipped). |
| RealToVisualRow | Converts a physical storage row index to its position among the rows actually rendered (display order applied, hidden and filtered rows skipped). |
| SaveSettingsToFile | Saves the grid settings to a file for later restoration with LoadSettingsFromFile. |
| SaveSettingsToStream | Saves the grid settings to a stream for later restoration with LoadSettingsFromStream. |
| SetExportRect | Sets the rectangle used for layout calculations during an export. |
| SetLocalRect | Assigns the layout rectangle of the grid, normally the client rectangle of the host control. |
| StretchColumns | Resizes columns so that together they fill the available width. |
| StretchRows | Resizes rows so that together they fill the available height. |
| UnhideAll | Shows all explicitly hidden rows and columns again. |
| UnhideAllColumns | Shows all hidden columns again. |
| UnhideAllRows | Shows all explicitly hidden rows again. |
| UnhideColumn | Shows a column that was hidden with HideColumn. |
| UnhideRow | Shows a row that was hidden with HideRow. |
| Update | Recalculates the grid layout. |
| UpdateColumnRowCalculations | Recalculates the total content size and the fixed-band totals, and clears the cached row and column positions. |
| UpdateVisualRange | Recalculates which scrollable rows and columns fall within the viewport. |
| VisualToRealColumn | Converts a position among the rendered columns (display order applied, hidden columns skipped) back to the physical storage column index. |
| VisualToRealRow | Converts a position among the rendered rows (display order applied, hidden and filtered rows skipped) back to the physical storage row index. |
Events
| Name | Description |
|---|---|
| OnCanLoadProperty | Occurs for each property while settings are loaded, letting you skip individual properties. |
| OnCanSaveProperty | Occurs for each property while settings are saved, letting you exclude individual properties. |
| OnLogMessage | Occurs whenever the grid logs a diagnostic message. |
| OnNotifyEditor | Notification used by the design-time columns editor to refresh itself after structural changes. |