I'm using FNCGrid with FNCGridDatabaseAdapter.
I cannot set the columns horizontal alignment through Columns[n].HorzAlignment . After loading data, everything is left-aligned, even thos columns I've set with center or trailing horzaligment.
I tried UseColumns = True/False , nothing changed.
How can I avoid having to set HorzAlignment for every single cell of the grid to get it done?
for nCol := 1 to grd.TotalColCount - 1 do begin
for nLin := 0 to grd.TotalRowCount - 1 do
grd.HorzAlignments[nCol, nLin] := grd.Columns[nCol].HorzAlignment;
It can't someway be done just using the Columns collection ?
You can override all layout or appearance settings from cells, columns and rows for the entire grid unconditionally from the OnGetCellLayout event.
Ok, but in what situation is it supposed to use what is set via Columns[n].HorzAlignment ? UseColumns=-True? UseColumns=False? Other property I should set?
Because now I noticed it's not related to the data adapter. Even with a normal and not data-linked grid, if I've saved it's appearances settings, It does not apply what was saved under each columns HorzAlignment for every corresponding cell when I call "LoadSettingsFrom".
When UseColumns is true, it will use the properties in the column. But as soon as you add set values with HorzAlignments for example which are based on cell properties, the cell properties will take over.
It doesn't. I tried UseColumns True/False; Loading data before loading settings, loading settings before loading data. No way.
I'm using OnGetCellLayout event now.
Could you please check what would be the real use of Columns[n].HorzAlignment when one manually load the grid settings from a stream or file? (I'm using loadsettingsfromstream in web core).
Now I'm using it like a "bridge", a temporary storage for the value, so I don't have to check which column data corresponds inside of OnGetCellLayout.
procedure TAPPFormGrid.grdGetCellLayout(Sender: TObject; ACol,
ARow: Integer; ALayout: TTMSFNCGridCellLayout;
ALayout.TextAlign := grd.Columns[ACol].HorzAlignment;
I'll check what happens & which setting has priority, either way, the OnGetCellLayout overrules it all
Please verify what it was supposed to do when we "LoadSettings" from file/stream and there are no customized appearance settings at cell level.
No news ?
Now I have another issue with FNCGrid alignment settings.
FNCGrid cells alignment don't run after inserting column
We are currently reworking the grid so we'll take this into account.