Skip to main content
Table of Contents

TTMSFNCDataGridCellAppearance Class

Global cell appearance for the grid. Holds one TTMSFNCDataGridCellLayout per visual state (normal, selected, fixed, group, etc.). These layouts define the default look for every cell.

API unit family: TMSFNCDataGridRenderer Inherits from: TPersistent

Syntax

GeneratedPascalC++
TTMSFNCDataGridCellAppearance = class(TPersistent)
class PASCALIMPLEMENTATION TTMSFNCDataGridCellAppearance : public System::Classes::TPersistent

Remarks

The grid exposes one instance through its CellAppearance property; each column has its own instance (TTMSFNCDataGridColumn.Appearance) that is used instead of the grid-level one only when gcsAppearance is included in the column's TTMSFNCDataGridColumn.Settings.

For a normal-state cell the layout is chosen in this order: group node rows use GroupLayout, summary rows SummaryLayout, rows evaluated by a filter that applies appearance use FilterMatchLayout / FilterInverseMatchLayout, banded rows BandLayout, and all other cells NormalLayout.

A per-cell layout assigned through the grid's Layouts property fully replaces NormalLayout. For the other states only its font, text alignment, text angle, word wrapping, trimming, text margins and sides are merged in, unless an OnGetCellLayoutHasPriority handler grants it full priority. Changing any layout repaints the grid.

Properties

Name Description
BandLayout Layout applied to alternating banded rows when TTMSFNCDataGridBandingOptions.Enabled is True. Default fill is light yellow.
FilterInverseMatchLayout Layout applied to normal rows that do not match the active filter when the filter highlights rows instead of hiding them.
FilterMatchLayout Layout applied to normal rows that match the active filter when the filter highlights rows instead of hiding them. Default fill is a light green.
FixedLayout Layout applied to fixed header and footer cells (fixed rows and fixed columns). Default fill is a very light grey.
FixedSelectedLayout Layout applied to fixed cells whose row or column contains the current selection, when TTMSFNCDataGridSelectionOptions.ShowSelectionInFixedCells is True.
FocusedLayout Layout applied to the focused cell (the keyboard cursor position). Default fill is a light steel blue, slightly darker than SelectedLayout.
GroupLayout Layout applied to group header (node) rows created when the grid data is grouped. Takes precedence over banding and filter highlighting.
NormalLayout Default layout applied to all ordinary (non-fixed, non-selected, non-grouped, non-banded) data cells.
SelectedLayout Layout applied to selected data cells. Default fill is a very light steel blue.
ShowFocus Indicates whether the focused cell should be visually marked. Default is True.
SummaryLayout Layout applied to summary rows (calculated totals) that appear when the grid data is grouped.

Usage examples

Customise grid appearance at three layers (grid, column, cell)

Override the global cell appearance, the per-column appearance, or apply per-cell layouts for fine-grained control.

Customise grid appearance at three layers (grid, column, cell)Pascal
procedure TForm1.FormCreate(Sender: TObject);
begin
  // Grid-wide override: focused cells get a red fill.
  Grid.CellAppearance.FocusedLayout.Fill.Color := gcRed;
  Grid.CellAppearance.SelectedLayout.Fill.Color := gcLightSteelBlue;

  // Per-column override: column 1 has its own focused style.
  Grid.Columns[1].Appearance.FocusedLayout.Fill.Color := gcGold;
  Grid.Columns[1].AddSetting(gcsAppearance);

  // Per-cell override (single cell affecting all states):
  Grid.Layouts[3, 3].Fill.Color := gcLime;
  Grid.Layouts[3, 3].Font.Style := [TFontStyle.fsBold];
  Grid.Layouts[3, 3].TextAlign := gtaTrailing;

  // Banded rows
  Grid.Options.Banding.Enabled := True;
  Grid.CellAppearance.BandLayout.Fill.Color := gcWhiteSmoke;

  // Adapt to the active TMS FNC application style (light/dark)
  Grid.AdaptToStyle := True;
end;

Read the related guide

Used by