What you can do is set the active record before accessing the data, please see the complete same based on the biolife.xml database inside a TClientDataSet
type
TTMSFNCGridDataBaseAdapterOpen = class(TTMSFNCGridDatabaseAdapter);
procedure TForm13.TMSFNCGrid1GetCellLayout(Sender: TObject; ACol, ARow: Integer;
ALayout: TTMSFNCGridCellLayout; ACellState: TTMSFNCGridCellState);
var
d: TTMSFNCGridDataBaseAdapterOpen;
ar, c, r: Integer;
f: TField;
i: Integer;
begin
r := ARow;
if (r <= TMSFNCGrid1.FixedRows - 1) then
Exit;
c := ACol - TMSFNCGrid1.FixedColumns;
if (c >= 0) and (c <= TMSFNCGrid1.Columns.Count - 1) then
begin
d := TTMSFNCGridDataBaseAdapterOpen(TMSFNCGridDatabaseAdapter1);
if d.CheckDataSet then
begin
ar := d.DataLink.ActiveRecord;
try
d.SetActiveRecord(ARow);
f := d.FieldAtColumn[c];
if Assigned(f) then
begin
i := 0;
if TryStrToInt(f.AsString, i) then
begin
if i > 50 then
begin
ALayout.Fill.Color := gcRed;
end;
end;
end;
finally
d.DataLink.ActiveRecord := ar;
end;
end;
end;
end;