[Lazarus] Lazreport variables
Jesus Reyes A.
jesusrmx at gmail.com
Thu May 7 05:37:45 CEST 2020
En Sun, 03 May 2020 11:03:12 -0500, Santiago A. via lazarus
<lazarus at lists.lazarus-ide.org> escribió:
> Hi:
>
> I want to write a report where even lines are written with no background
> and odd lines with a light >gray background.
> The idea is an memo (MemoBackground) in the background of the masterData
> Band that is gray and I >set visible or invisible, according with the
> line.
>
> I have created a report variable "LineCounter"
>
> In the ColumnHeader band (the report has two columns) I have a Script
> Begin
> LineCounter:=0;
> end;
> In the GorupHeader header I have this script
> Begin
> LineCounter:=0;
> end;
> In the masterData band Script:
> begin
> LineCounter:=LineCounter+1;
> MemoBackground.visible:=(LineCounter mod 2 = 0);
> end
>
Probably the easiest way of doing what you want is using an empty memo
object sized to the extent you want for the background row, any other
field on the band should be 'above' the background memo (you can just
select the background memo and press the 'send to bottom' tool button),
any field on the band should be transparent color. Then edit the
background memo and use this script:
if [LINE#] mod 2 = 0 then
FillColor := clGray
else
FillColor := clWhite;
As written and because the variable Line# starts at 1, the first line will
be white.
You can apply this method to any existing report as it doesn't require
modifying the source code of your application.
Regards.
Jesus Reyes A.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20200506/55ea7a46/attachment.html>
More information about the lazarus
mailing list