How to change TmsFmx/TmsFmxLiveGrid header font?


This look trivial but I don't know have to change TmsFmxGrid/TmsFmxLiveGrid header font ?


There is a FixedFont for each column in the columns collection.
Or alternatively you can use the following properties and pass the fixed row and first column indexes:

TMSFMXGrid1.FontNames[ACol, ARow: Integer]
TMSFMXGrid1.FontSizes[ACol, ARow: Integer]
TMSFMXGrid1.FontStyles[ACol, ARow: Integer]
TMSFMXGrid1.FontColors[ACol, ARow: Integer]

Kind Regards, 

Hi Pieter,

How does it works when grid is linked via livebindings ?
Columns linked via livebinding view are different from TMSFMXGrid columns collection.

I have tried this (on forms create handler)  but font size is unchanged.

TMSFMXGrid1.FontSizes[0, 0] := 128;
  TMSFMXGrid1.FontSizes[1, 0] := 128;
  TMSFMXGrid1.FontSizes[2, 0] := 128;
  TMSFMXGrid1.FontSizes[3, 0] := 128;

We have investigated this here, and the font size is changed when using the following code on an empty default grid:

  TMSFMXGrid1.FontSizes[1, 0] := 28;
  TMSFMXGrid1.Cells[1, 0] := 'Hello';

Even when the grid is connected through LiveBindings, the above code should still work.

Kind Regards, 

When dataset is closed and opened again, all grid column configuration is lost.
I'm doing this now

for i := 0 to TMSFMXGrid1.RowCount - 1 do
   for j := 0 to TMSFMXGrid1.ColumnCount  do
      TMSFMXGrid1.FontSizes[j, i] := 16;

Is there a way to make this persistent ?


To solve this issue you can override the OnGetCellLayout event and then customize the font size dynamically through the ALayout parameter, which will automatically be re-applied when clearing the columns.

Kind Regards, 

Is it possible to do this without creating a new class ? (will have to create a new package and so on...)

  TTMSFMXGridEx= class(TTMSFMXGrid)
    procedure DoGetCellLayout(ACol, ARow: Integer;
      ALayout: TTMSFMXGridCellLayout; ACellState: TCellState); override;

The OnGetCellLayout event is available at designtime for implementation. You can override the DoGetCellLayout as demonstrated in the sample below but it is currently not possible to save the font sizes and restore them without additional code. We will investigate how we can provide such functionality.

Kind Regards, 

It will be nice to have this feature.
BTW, you're talking about the samble bellow, but I don't see anything ?

Sorry, I meant the sample above in your post :)