Subject tib_grid font and brush color
Author stanw1950
I have these conditions for coloring a tib_grid:
(1)if row is current, brush is red, green, or highlight
(2)else if the row is not current, then the font is red, green, or
black.

The following code almost works, except that sometimes the brush
color of the first column, and only the first column, of the grid is
wrong, especially when going up the grid. What am I missing? Thanks
in advance.

procedure Tibo_ScreenTrack.gridDetailGetCellProps(Sender: TObject;
ACol,
ARow: Integer; AState: TGridDrawState; var AColor: TColor; AFont:
TFont);
begin
with gridDetail do begin
if DetailQ.Active
and not (gdFixed in AState)
and (ARow >= FixedRows) then begin
with DetailQ do begin
if AColor = clHighLight then begin
if ((BufferFieldByName('DateIn').AsDateTime > 0)
and (BufferFieldByName('DateOut').AsDateTime = 0)) then
AColor := clRed
else if ((BufferFieldByName('DateIn').AsDateTime > 0)
and (BufferFieldByName('DateOut').AsDateTime > 0)) then
AColor := clGreen
else
AColor := clHighlight;
end else begin
if (BufferFieldByName('DateIn').AsDateTime > 0)
and (BufferFieldByName('DateOut').AsDateTime = 0) then
AFont.Color := clRed
else if (BufferFieldByName('DateIn').AsDateTime > 0)
and (BufferFieldByName('DateOut').AsDateTime > 0) then
AFont.Color := clGreen
else
AFont.Color := clBlack;
end;
end;
end;
end;
end;