TTMSFNCDataGridConditionalFormatting Class
Ordered collection of conditional-formatting rules attached to a grid (renderer). Owns the per-scope statistics cache and the appearance evaluation entry points.
API unit family: TMSFNCDataGridConditionalFormatting
Inherits from: specialize TTMSFNCOwnedCollection<TTMSFNCDataGridFormatRuleItem>
Syntax
TTMSFNCDataGridConditionalFormatting = class(specialize TTMSFNCOwnedCollection<TTMSFNCDataGridFormatRuleItem>)
Remarks
Obtain it from TTMSFNCCustomDataGrid.ConditionalFormatting; the grid creates and frees it, so never free it yourself. Rules are added with Add or the AddXxx builders, which return the new TTMSFNCDataGridFormatRuleItem for further configuration, and can be edited visually with TTMSFNCCustomDataGrid.ShowConditionalFormattingEditor.
Every rule change clears the statistics and expression caches and raises OnChange, which makes the grid repaint. Aggregate statistics are computed lazily per rule over the visible data rows of its scope, and the grid discards them whenever cell values, sorting or filtering change; see InvalidateStats.
To add many rules at once, wrap the calls in BeginUpdate/EndUpdate.
Properties
| Name | Description |
|---|---|
| Enabled | When False, no rule in the collection is evaluated and no formatting is applied. Default is True. |
| Items | The rule at the given zero-based index. This is the collection's default array property. |
Methods
| Name | Description |
|---|---|
| Add | Appends a new, default-initialized rule to the collection. |
| AddAverageRule | Adds a grtAverage rule that compares a column's values against the scope's mean. |
| AddCellValueRule | Adds a grtCellValue rule that compares a column's value against a reference value. |
| AddColorScale | Adds a grtColorScale rule that paints a three-colour gradient over a column's values. |
| AddDataBar | Adds a grtDataBar rule that paints a proportional in-cell bar over a column's values. |
| AddDateHighlight | Adds a grtDate rule bucketed by a relative date interval, with the fill and font colour already applied. |
| AddDateRangeHighlight | Adds a grtDate rule that highlights values falling in the explicit date range .., both inclusive. |
| AddDuplicateHighlight | Adds a grtUniqueDuplicate rule with the fill and font colour already applied. |
| AddExpressionHighlight | Adds a grtExpression rule with the fill and font colour already applied. |
| AddExpressionRule | Adds a grtExpression rule that matches rows for which a boolean expression evaluates to true. |
| AddIconSet | Adds a grtIconSet rule that paints a threshold-based icon over a column's values. |
| AddTextHighlight | Adds a grtText rule with the fill and font colour already applied. |
| AddTextRule | Adds a grtText rule that compares a column's text against a reference string. |
| AddTopBottomRule | Adds a grtTopBottom rule that matches the top or bottom N values of a column. |
| AddValueHighlight | Adds a grtCellValue rule with the fill and font colour already applied. |
| AddValueRangeHighlight | Adds a grtCellValue rule with a gfcBetween comparison across the two bounds, both inclusive, with the fill and font colour already applied. |
| ClearRules | Removes and frees every rule in the collection. |
| EvaluateCellAppearance | Main entry point for the appearance pass. Applies every enabled, matching, non-overlay rule to for the given cell, honouring TTMSFNCDataGridFormatRuleItem.Priority and TTMSFNCDataGridFormatRuleItem.StopIfTrue. |
| GetOverlayInfo | Computes the overlay (data bar fraction or icon index) to paint for a cell. |
| InvalidateStats | Discards cached per-rule statistics and cached expression results so they are recomputed on next use. |
| OverlayRuleFor | Returns the first matching overlay rule (data bar or icon set) for a cell. |
| Update | Clears the statistics and expression caches, marks the priority-ordered view dirty and raises OnChange whenever a rule item changes. |
Events
| Name | Description |
|---|---|
| OnChange | Occurs whenever the rule collection or any rule it contains changes. |
| OnInternalChange | Internal notification used by the owning renderer. Application code should use OnChange. |