[Lazarus] How to color a field in a LazReport ?

Koenraad Lelong lazarus2 at de-brouwerij.be
Mon Mar 10 15:33:40 CET 2014


Hi,

I'm trying to make the background of dbfield in a LazReport different.
I tried using the userds example, but it does not work.
This is what I wrote :

procedure TDataModule1.frReport1EnterRect(Memo: TStringList; View: TfrView);
begin

if FNegative then
  View.FillColor:=clRed
else
   View.FillColor:=clWhite;
end;

procedure TDataModule1.frReport1GetValue(const ParName: String;
   var ParValue: Variant);
begin

Append(OutFile);
writeln(OutFile,ParName);
CloseFile(OutFile);
if ParName='qrySamenVatting."VERSCHIL"' then
   FNegative:=qrySamenVattingVERSCHIL.AsFloat<0.0
else
   FNegative:=false;
end;

This colors the wrong field. After some debugging I found EnterRect is 
fired before GetValue. So, how can I modify the color based on the value ?


Koenraad.




More information about the Lazarus mailing list