Subject | RE: [IBO] Colors in Grid |
---|---|
Author | Thomas Steinmaurer |
Post date | 2003-03-10T18:54:13Z |
Hi Ross,
the font and background color is set.
An example (not fully checked, but you might get the idea):
procedure TfmMainForm.IB_Grid1GetCellProps(Sender: TObject; ACol, ARow: Integer; AState: TGridDrawState; var AColor: TColor; AFont:
TFont);
begin
with IB_Query1 do begin
if Active and (ARow > 0) and (ACol > 0) then begin
BufferRowNum := IB_Grid1.DataRow[ARow];
if (BufferRowNum > 0) then begin
if not (gdSelected in AState) then begin
AFont.Color := BufferFieldByName('FONTCOLOR').AsInteger;
AColor := BufferFieldByName('BACKGROUNDCOLOR').AsInteger;
end;
end;
end;
end;
end;
The Contact sample in %IBO%\Samples\Contact might be useful too.
HTH,
Thomas Steinmaurer
http://www.iblogmanager.com
> >Not a property setting, since these apply to entire rows or columns. ButI'm using the OnGetCellProps event. Dependent of a column value
> >have you investigated the OnDrawCell event?
>
> Yes. I assumed it would require coding. I don't see how you can get the
> current column or row being drawn in the on OnDrawCell event.
the font and background color is set.
An example (not fully checked, but you might get the idea):
procedure TfmMainForm.IB_Grid1GetCellProps(Sender: TObject; ACol, ARow: Integer; AState: TGridDrawState; var AColor: TColor; AFont:
TFont);
begin
with IB_Query1 do begin
if Active and (ARow > 0) and (ACol > 0) then begin
BufferRowNum := IB_Grid1.DataRow[ARow];
if (BufferRowNum > 0) then begin
if not (gdSelected in AState) then begin
AFont.Color := BufferFieldByName('FONTCOLOR').AsInteger;
AColor := BufferFieldByName('BACKGROUNDCOLOR').AsInteger;
end;
end;
end;
end;
end;
The Contact sample in %IBO%\Samples\Contact might be useful too.
HTH,
Thomas Steinmaurer
http://www.iblogmanager.com