Subject Re: [IBO] First col colouring in IB_Grid
Author colletb@marronniers.be
--- In IBObjects@y..., lester@l... wrote:
> See my post on IB_Grid cells colors - you need to select the
> correct line in Buffer before using BufferFieldByName.
> --
> Lester Caine
> -----------------------------
> L.S.Caine Electronic Services

Thanks for the suggestion.

My code is now :

procedure TFormeEntreeSortie.GrilleDepartGetCellProps(Sender: TObject;
ACol, ARow: Integer; AState: TGridDrawState; var AColor: TColor;
AFont: TFont);
begin
if qryDepart.Active and not (gdFixed in AState) and
(ACol <> Abs(qrydepart.OrderingItemNo)) then
begin
// ---> added line following your suggestion
qrydepart.BufferRowNum := GrilleDepart.DataRow[ARow];
// ---
if qryDepart.BufferFieldByName('depart').AsDateTime = 0 then
begin
AColor := clLime;
AFont.Color := clBlack;
end
else // Depart <> 0
if qrydepart.BufferFieldByName('retour').AsDateTime = 0 then
if Date + Time <= qrydepart.BufferFieldByName
('fin').AsDateTime then
begin
AColor := clYellow;
AFont.Color := clBlack;
end
else // Date + Time > Fin
begin
AColor := clRed;
AFont.Color := clWhite;
end
else // Retour <> 0
begin
AColor := clLime;
AFont.Color := clBlack;
end;
end;
end;

That works now totally well

Bernard Collet