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

Template Problems

edited May 2002 in General
I'm developing an app that will have over 100 report in it. So I am
using a database template structure to contain the reports. I'm having
problem with lost or renamed event handlers when I add or delete
components to new reports. I use the Save As to save the reports but
it doesn't resolve the event handler names (Rpt1, Rpt2, etc). Is
there an easy way to solve this problem? I found an article in the
tech-tips but it didn't help much. Any help appreciated.

Bob

Comments

  • edited May 2002
    Hi Robert,

    You have to re-assign all event methods after loading.

    regards,
    Chris Ueberall;
  • edited May 2002
    Chris,

    For over 100 reports, there has to be an easier way. All report will
    have different components and BeforePrint events. When I do a SaveAs
    why doesn't the Event handlers get renamed?

    Bob

  • edited May 2002
    Robert,

    When you save a template all published properties are streamed (standard
    Delphi component streaming).
    If the events used at this time also exist during load time, there should be
    no problem.
    Re-assigning events and properties for over 100 reports is just the same as
    doing it just for one, in my application.
    I see no reason and no way to rename any eventhandler when doing a SaveAs,
    what event name should be used than the one actually used.
    When you assign the eventhandlers by code you will have the advantage that
    you can use every template whenever it was designed, jmy2c. If I would
    decide to use an 'AfterPrint' event in this case in the future, I would have
    to add on line of code to get this functionality for all my reports.
    Maybe I have something misunderstood what on your side happend?

    regards,
    Chris Ueberall;

  • edited May 2002
    Chris,

    No I'm the one that is confused. I'm having problems seeing the forest
    for all the trees. As I stated I have over 100 different reports I'm
    using as templates for flyers. Each one can have different components
    from the first one and if I have code in the Beforeprint event I get
    an error when I compile the app. If I reload the first report then
    the compile works. How do I make sure that all event handlers are
    properly assigned? I must be missing something simple here. I
    developed a work around by placing all components on every report and
    making then visible or not. This seems like a kludge to me.
    Thanks for your help.

    Bob

  • edited May 2002
    There is a known issue with groups and their event handlers getting out of
    sync if you use RAP. If you think that might be your problem, please email
    support@digital-metaphors.com to request a patch. Otherwise please read, if
    you haven't yet, the 'Losing Event Handlers Explained' article in TechTips |
    Templates. If you load a template into a report object that is connected to
    the event handlers created at design time the template should resync itself.
    Otherwise you manually have to reassign the event handlers after loading the
    template (i.e. Report.BeforePrint := ReportBeforePrintEvent; etc...)

    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

This discussion has been closed.