Subject tib_Grid cell colors
Author stanw1950
I'm using the procedure below to change the color and font of cells
for certain fields. It works fine except when I change the sort
order. Then, all cells above the current record have the normal
default colors. What do I need to change to fix this problem? Thanks
in advance. (D6;IBO 4.2.hc)

Stan Walker


procedure TScreenHotSheet.grHotGetCellProps(Sender: TObject; ACol,
ARow: Integer; AState: TGridDrawState; var AColor: TColor; AFont:
TFont);
var
tmpFld: TIB_Column;
begin
with HotQ do begin
if not Active then exit;
BufferRowNum := grHot.DataRow[ARow];
if ((BufferRowNum > 0) and (ARow >= grHot.FixedRows)) then begin
tmpFld := grHot.GridFields[grHot.DataCol[ACol]];
if ((Assigned(tmpFld)) and (AFont.Color <> clHighlightText))
then begin
if tmpFld.FieldName = 'ITEMID' then
AFont.Color := clBlue
else if tmpFld.FieldName = 'SLIDE' then begin
AColor := clRed;
AFont.Color := clWhite;
end else if tmpFld.FieldName = 'PULLIN' then begin
AColor := clGreen;
AFont.Color := clWhite;
end;
end;
end;
end;
end;