How to Use Styles > Applying Styles to Cells > Cell style evaluation order |
The following list defines the order in which cell styles are applied relative to the anonymous styles of a grid, split, or column.
Style property, TDBGrid control. The default named parent of this anonymous style is Normal.
Style property, Split object. By default, this anonymous style inherits from its TDBGrid control counterpart.
EvenRowStyle and OddRowStyle properties, Split object. By default, these anonymous styles inherit from their TDBGrid control counterparts, which in turn have default named parents of EvenRow and OddRow. These properties apply only if the AlternatingRowStyle property is True.
Style property, Column object. By default, this anonymous style inherits from its Split object counterpart.
FetchRowStyle event. This event fires only if the FetchRowStyle property is True for a grid or split.
SelectedStyle property, Split object. By default, this anonymous style inherits from its TDBGrid control counterpart, which in turn has a default named parent of Selected. This property applies only to selected rows; that is, rows whose bookmarks have been added to the SelBookmarks collection through code or user interaction.
HighlightRowStyle property, Split object. By default, this anonymous style inherits from its TDBGrid control counterpart, which in turn has a default named parent of HighlightRow. This property applies only to highlighted rows; that is, the current row in a grid or split whose MarqueeStyle property is set to 3 - Highlight Row or 4 - Highlight Row, Raise Cell.
AddCellStyle and AddRegexCellStyle methods, if called. Cell styles specified at the Column object level have the highest priority, followed by those specified at the Split object and TDBGrid control levels. Within an object level, cell styles are tested in the order in which they were added in code. Cell styles do not inherit from one another; as soon as a match is found, testing stops.
FetchCellStyle event. This event fires only if the FetchStyle property is set to dbgFetchCellStyleColumn or dbgFetchCellStyleAddNewColumn for a Column object.
Thus, you always have final control over the rendering of a cell via the FetchCellStyle event.