Subject Re: [IBO] Re: IB_Grid cells color
Author lester@lsces.co.uk
> Use "BufferFieldByName" rather than "FieldByName".
>
> > procedure TForm1.IB_Grid1GetCellColor(Sender: TObject; ACol, ARow:
> > Integer;
> > AState: TGridDrawState; var AColor: TColor);
> > begin
> > with IB_Grid1 do
> > begin
> > {Pone la celda en Amarillo si es el precio y es menor que 0}
> > if ARow = Row then
> > if ACol = Col then
> > if (Assigned( GridFields[ DataCol[ACol]])) and
> > (GridFields[ DataCol[ACol]].FieldName = 'ARTPRE') then
> > if IB_Query1.FieldByName('artpre').AsFloat < 0 then
> ------------
> I think you should use here :
>
> if IB_Query1.BufferFieldByName('artpre').AsFloat < 0 then
> ...
> ------------
> > AColor := clYellow;
> >
> > end;
> > end;
> >
> >
> > Thanks.

Need a bit more that that - need to point the Buffer at the
right line first!

C++ Im afraid, but you should get the idea

int BufferRowNumber = IB_Grid1->DataRow[ARow];
if ( BufferRowNumber )
{ IB_Query1->BufferRowNumber = BufferRowNumber;
if IB_Query1.BufferFieldByName***
}

Unles someone knows different?

--
Lester Caine
-----------------------------
L.S.Caine Electronic Services