Recent

Author Topic: Accessing LazReport Components by code  (Read 1490 times)

essence-ciel

  • New Member
  • *
  • Posts: 17
Accessing LazReport Components by code
« on: August 25, 2024, 04:49:17 am »
Hello,
Sorry for my bad English. I'm not familiar with the forums, excuse me too.

I'm trying to access frReport (LazReport) components programmatically from a Lazarus form (Settings form).

In order to find the components, I used this code:

Code: Pascal  [Select][+][-]
  1. for I := 0 to frReport1.ComponentCount -1 do
  2.       if (frReport1.Components[I] is TGroupHeader) then
  3.             frReport1.GroupHeader1.Visible := CheckBox3.Checked;
     

But it's impossible to display/hide the frReport GroupHeader. Ditto for changing the color of the associated Memo.

How can I retrieve the component and modify it by code, please?

Windows 11, Lazarus 3.4, Sqlite 3.46.1

paweld

  • Hero Member
  • *****
  • Posts: 1268
Re: Accessing LazReport Components by code
« Reply #1 on: August 25, 2024, 08:00:57 am »
You can solve this in several ways:
1. use parameters that can be used in the script for each band / memo
2. use the events OnBeginBand (for the band) and OnEnterRect (for the memo)
3. create reports dynamically using the lrCodeReport component - an example can be found in the directory: "{LazarusDir}\components\lazreport\source\addons\lrcodereport\sample\"   
 
The first two points are in the attached example
Best regards / Pozdrawiam
paweld

essence-ciel

  • New Member
  • *
  • Posts: 17
Re: Accessing LazReport Components by code
« Reply #2 on: August 26, 2024, 04:48:49 am »
Hi,
Thanks a lot. I'll study code and apply it.
Best regards,
Patrick

 

TinyPortal © 2005-2018