Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Can't assign DetailBand events in code

edited April 2008 in General
Delphi 6, RB Ent 10.07.

At design-time I can see four events against TppDetailBand (AfterGenerate,
AfterPrint, BeforeGenerate and BeforePrint).

However, if I wanted to not set those at design time, but at run-time, I
can't see how to get access to the event? That's if I use
ppReport1.DetailBand.

Looking through the RB source, the BeforePrintEvent is part of the
BandEngine but neither the BeforePrint event nor the BandEngine are
available in code to use, so I can't assign a handler to the the event. The
only event available appears to be OnPrint which isn't actually one of the
published events in the Obj Inspector.

However, if I use ppReport1.Bands[0]. then the events are available to me.
However, then I'm not sure I'm setting the correct band.

And if I cast the DetailBand as a TppBand, then I get the event:
TppBand(ppEmployeeBadge.DetailBand).BeforePrint

Why aren't the events available for the ppReport.DetailBand property? Surely
it's a TppBand descendant?

Thanks,
J.

--
Jason Sweby
Software Development Manager,
Carval Computing Limited, Plymouth, UK

Payroll - HR - T&A - Access Control

Comments

  • edited April 2008

    TppBand defines BeforePrint, AfterPrint etc. as a published properties. All
    bands descend from TppBand.

    Either of these will compile....

    ppReport1.DetailBand.BeforePrint := ehDetail_BeforePrint;

    or

    ppReport1.Detail.BeforePrint := ehDetail_BeforePrint;



    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited April 2008
    Interesting; you're right, it's just that the BeforePrint event did not
    appear in Delphi's CodeCompletion box. But entering it anyway and compiling
    worked.

    Thanks.

This discussion has been closed.