I have a TGrid with a mixture of columns (ImageColumn and StringColumn). I can populate it using onGetValue event which works fine. My questions are:
How to force the entire grid to rebuild and cause onGetValue event? I'm using UpdateStyle at the monent.
How can I update a single cell in the grid?
The grid updates only visible cells! Grid1.UpdateStyle
force the grid to rebuild and is causing onGetValue
events but its slow. Grid1.ReAlign
is much faster.
As soon as cells become visible, they will be updated.
Updating 1 cell:
procedure TForm1.UpdateCell(col, row: integer);
var
cell: TStyledControl;
begin
cell := Grid1.Columns[col].CellControlByRow(row);
if Assigned(cell) then
cell.Data := 'Note: use the same datasource as OnGetValue';
end;
cell is not assigned when row never become visible.
The other option is to call Grid1.beginUpdate;
make your changes and then call Grid1.endupdate;
which will cause the visible grid to recalculate and redraw.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With