Topic: Changing colors in a table grid
Hi All,
I would like to have a field and text in a tablegrid change color when the field contains a certain word (Overdue). I have the following code and it works fine. Note this code came from an earlier post from Derek(thanks Derek):
procedure frmMainMenu_tblGridInstalled_OnChange (Sender: TObject);
var
i,c: integer;
begin
c := frmMainMenu.tblGridInstalled.RowCount -1;
for i := 0 to c do
begin
if frmMainMenu.tblGridInstalled.Cells[4,i] = 'Overdue' then
begin
frmMainMenu.tblGridInstalled.Cell[4,i].Color := clRed;
frmMainMenu.tblGridInstalled.Cell[4,i].TextColor := clWhite;
end;
end;
end;
.
My problem is when I go back into the table grid at a later time, and I highlight one of the rows that has the Red/White text, it changes to Black.
.
Then when I move to another row, this row changes to Black and the previous row I had selected goes back to Red/White. I've been trying to find out why this happens and haven't found an answer so far.
.
Any thoughts will be appreciated.
Thanks, Frank