I know. I just took the demo to reuse the toolbar & other formatting logic.
I didn't notice there was a previous OnSelectCell event defined for the AdvStringGrid.
This did the job I needed:
type
TCellDataX = class(TTMSFNCDataGridCellItemExtended);
procedure TForm1.GridPrincipalGetCellLayout(Sender: TObject; ACell:
TTMSFNCDataGridCell);
var
ADG : TTMSFNCDataGridRenderer;
ACellData: TTMSFNCDataGridCellItemExtended;
ALayout : TTMSFNCDataGridCellLayout;
begin
ADG := TTMSFNCDataGridRenderer(Sender);
if ADG.IsCellSelected(ACell.Coordinate) then begin
ACell.Layout.Assign(ADG.CellAppearance.SelectedLayout);
ACellData := ADG.CellDataExtended[ACell.Coordinate.Column, ACell.Coordinate.Row];
if Assigned(ACellData) then begin
ALayout := TCellDataX(ACellData).Layout;
if Assigned(ALayout) then begin
ACell.Layout.Font.Name := ALayout.Font.Name;
ACell.Layout.Font.Size := ALayout.Font.Size;
ACell.Layout.Font.Style := ALayout.Font.Style;
ACell.Layout.TextAlign := ALayout.TextAlign;
ACell.Layout.VerticalTextAlign := ALayout.VerticalTextAlign;
ACell.Layout.TextAngle := ALayout.TextAngle;
end;
end;
end;
end;