Subject Re: [IBO] ib_grid.ondrawcell and ongetcellprops
Author Markus Ostenried
At 03:12 Saturday, 12.07.2003 +0000, you wrote:
>procedure TForm_request.IB_Grid2GetCellProps(Sender: TObject; ACol,
> ARow: Integer; AState: TGridDrawState; var AColor: TColor; AFont:
>TFont);
>begin
>if usage.Active then
>begin
>if not (gdfixed in AState) then
>begin
>if usage.bufferFieldByName('Status').AsString = 'CAN' then
> afont.Color:=clred;
>end; // if not astate = gdfixed then
>end; // if usage.active then
>end;

Here you don't set the current record of the dataset's buffer. When drawing
a cell you can only tell which record it belongs to from reading the ARow
parameter. E.g. if you move another form over your grid and away again then
a bunch of cells has to be repainted. These cells may belong to different
rows and therefore different records. Thus you have to set the current
record in the dataset's buffer accordingly *before* you access its fields.

Try this instead:
...
usage.BufferRowNum := IB_Grid2.DataRow[ ARow ];
if usage.bufferFieldByName('Status').AsString = 'CAN' then
afont.Color:=clred;
...

Hope this helps,
Markus