Subject | Re: [IBO] ib_grid.ondrawcell and ongetcellprops |
---|---|
Author | Markus Ostenried |
Post date | 2003-07-12T03:42:41Z |
At 03:12 Saturday, 12.07.2003 +0000, you wrote:
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
>procedure TForm_request.IB_Grid2GetCellProps(Sender: TObject; ACol,Here you don't set the current record of the dataset's buffer. When drawing
> 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;
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