[Lazarus] Lazreport variables

Santiago A. svaa at ciberpiula.net
Thu May 7 10:08:54 CEST 2020


El 07/05/2020 a las 05:37, Jesus Reyes A. via lazarus escribió:
> 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.
>

Ok I'll try
Nevertheless, that doesn't answer my question: How to use 
"not-predefined" variables. How can I access to the variable lineCounter?


-- 
Saludos

Santiago A.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20200507/3295a105/attachment-0001.html>


More information about the lazarus mailing list