Recent

Author Topic: Firtes4Lazarus - Creating a Report in Code  (Read 509 times)

phil_v

  • New member
  • *
  • Posts: 12
Firtes4Lazarus - Creating a Report in Code
« on: November 09, 2018, 06:05:26 am »
Hi, I'm using

OS W10  64Bit
Lazarus V 1.8.4
FPC V3.0.4
SVN 57972
x86_64-win64-win32/win64

Fortes4Lazarus

I've been using Fortes Report, with excellent results. I'm now trying to create a report in code.
Initially, I just want to create a Report with a HeaderBand, containing a label.
The code attached displays the report with report borders showing, but does not show the Page Header band containing the label. I am obviously missing something important about creating bands in the report.
Thks in advance

GetMem

  • Hero Member
  • *****
  • Posts: 3330
Re: Firtes4Lazarus - Creating a Report in Code
« Reply #1 on: November 09, 2018, 06:41:36 am »
You forgot to add the parent control for both the band and the label(Parent := MyReport, Parent := B_PageHead respectively). Other then this your code will leak, you should free the report somewhere. Another question: why don't you use the report designer? Creating each and every control dinamically it's a very difficult task, especially on a complex report.
« Last Edit: November 09, 2018, 06:55:35 am by GetMem »

phil_v

  • New member
  • *
  • Posts: 12
Re: Firtes4Lazarus - Creating a Report in Code
« Reply #2 on: November 09, 2018, 07:43:43 am »
Thankyou GetMem,
Yes, I agree, creating reports in code is not optimal.
I use the designer for all of my "standard" reports in the application, but I have a need to create a report for 6 queries that have differing numbers of columns. So, I thought I would try the code method for these and dynamically add columns to the report according to the columns contained in the queries.
I may revert to creating them with the designer, if it's too difficult.