Define variable in report header band

Отправлено из мобильной Яндекс.Почты: http://m.ya.ru/ymail

11:09, 7 мая 2020 г., "Santiago A. via lazarus" <lazarus@lists.lazarus-ide.org>:
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@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.
--
_______________________________________________
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus
-- 
_______________________________________________
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to