Create components in BeforeDetailBandGenerate
Hi,
I'm using Delphi 2009 and RB 14 Professional.
I'm trying to create some labels during the detail band's before
generate event, but although they are created without error, they don't
appear on the report the first time I run it. If I run it a second time
they appear fine (the components are not destroyed in between, so they
already exist by the time the report is run a second time).
Is there anything I can do to get the components to show the first time
the report is run?
Thanks,
Steve Branley
I'm using Delphi 2009 and RB 14 Professional.
I'm trying to create some labels during the detail band's before
generate event, but although they are created without error, they don't
appear on the report the first time I run it. If I run it a second time
they appear fine (the components are not destroyed in between, so they
already exist by the time the report is run a second time).
Is there anything I can do to get the components to show the first time
the report is run?
Thanks,
Steve Branley
This discussion has been closed.
Comments
The BeforeGenerate is likely too late to add components to a band. Try
using an earlier event such as the BeforePrint or StartPage of the report.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Thanks for that. I had a feeling you were going to say it was too late.
Trouble is, I can't do what I need to do any earlier.
Might have to have a rethink.
Thanks,
Steve
One option would be to manually add lower level drawcommands to the page
rather than components. Drawcommands are positioned in page coordinates
in microns so some conversion will need to be done to position them
correctly. You should be able to use the Band.PrintPosRect as a
starting point.
Take a look at the following article on manually adding a watermark to a
page. You could do something similar in the BeforeGenerate event of the
band.
http://www.digital-metaphors.com/rbWiki/Delphi_Code/Formatting/How_To...Manually_Add_a_Watermark_to_a_Page
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
This looks to be just what I need with just one problem: PrintPosRect is
(0,0,0,0) every single time for the detail band, yet there are several
detail records on the page. Is there any other way of working out the
page position?
Thanks,
Steve
I apologize, try using the PrintPosRect property of the report engine
rather than the band.
Report.Engine.PrintPosRect
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Steve