I have a TMSFNCGrid connected with a Grid database adapter.
I used OnCellBeforeDraw OnCellAfterDraw to change the color of the font like this:
if (ACol = 2) and (ARow > 0) then begin sMyValue := MyFncGrid.Cells[ACol, ARow]; if sMyValue <> '0' then Begin AGraphics.Font.Color := gcLime; End; end;
Because nothing changed visually I found out that MyFncGrid.Cells[ACol, ARow] is always empty string although in the grid there are values.
I changed the code to:
procedure TFormEgyCim.MyFncGridCellBeforeDraw(Sender: TObject; ACol, ARow: Integer; AGraphics: TTMSFNCGraphics; var ARect, ATextRect: TRectF; var ADrawText, ADrawBackGround, ADrawBorder, AllowDraw: Boolean); begin If MyFncGrid.Cells[ACol, ARow]<>'' Then ShowMessage(ACol.ToString+':'+ARow.ToString+' '+ MyFncGrid.Cells[ACol, ARow]);
It never goes to the ShowMessage section so MyFncGrid.Cells[ACol, ARow] doesn't get the real values of the cell.
Meanwhile I found out that if I use LoadAllDataAndDisconnect then it starts coloring, however this is not an option because I need to update constantly the data in the underlying table.
This is like having a car where I can choose either I want to use only the gas pedal or the break pedal, but not both.
What can I do? Thank you!