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

tracing through code after printing

edited March 2007 in End User
Dear all,
I am working through the LabelsSkipPlusQuantity code suggested by
Nard, and there are severe problems, but when I try to trace through the
code, once I hit the print button, the debug seems to be switched off, so I
cannot see what is happening with the ppReport3StartPage,
ppDetailBand3BeforePrint, etc.
What do I need to do so I can trace through this?

thanks

John

Comments

  • edited March 2007
    Hi John,

    ReportBuilder does not have anything built-in that will affect your ability
    to debug code.

    1. Be sure your library path is pointing toward the \RBuilder\Source\...
    directory.
    2. Be sure your project debug options in Delphi are properly set.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited March 2007
    Dear Nico,
    thanks for the fast reply.
    This is driving me nuts. The F7 Trace Into works fine until I get to the
    line which brings up the print preview.
    Opening the print dialog and then printing kills of the trace through. Any
    break points are ignored.

    Adding the rbuilder/source or lib directories to various library lists
    merely means that I step through every line of ppReport, ppDBpipe, which I
    don't really want.

    I never have a problem with F7 anywhere else, it must be something really
    stupid!!??

    regards

    John





  • edited March 2007
    Dear Nico,
    I may have an answer, and another question.

    I am using LoadfromDatabase to automatically select a template
    from a user defined list of report labels.

    I am using code to track the exact number of labels to print per page using
    the example from LabelsSkipPlusQuantity.zip.

    My component is called ppReport3.
    I use the line ppreport3.Template.LoadFromDatabase; and it loads the correct
    template.

    If I then want to use code in the report onstartpage event I was using
    ppReport3StartPage etc. I guess that my loadfromdatabase meant that the
    loaded report has a different name, and its detailband also has a different
    name.

    Would this be the reason my code was not getting executed?

    How would I access the component names of the loaded report and
    reportdetailband?

    regards

    john







  • edited March 2007
    Hi John,

    If you are loading templates, you are most likely loosing your event handler
    references. The most graceful way around this problem is to keep all your
    event code local to the template using RAP. Otherwise you will need to be
    sure the template is saved with the same event names as the events in Delphi
    or assign the events after the template has loaded.

    --------------------------------------------
    Article: Troubleshooting Lost Event Handlers
    --------------------------------------------

    Let's assume you have created a report in Delphi and assign an event
    handlers to the OnPreviewFormCreate event of the report. The event is
    generated by Delphi as:

    procedure TForm1.ppReport1PreviewFormCreate(Sender: TObject);

    You then save the report to an RTM file 'Report1.RTM.' The events are
    stored as references only, and so the RTM contains:

    object ppReport1: TppReport
    .
    .
    OnPreviewFormCreate = ppReport1PreviewFormCreate
    end

    You then go on to work on a different report. Saving it with under then
    name 'Report2.RTM'. Only this time, before you save the report you
    change the report component name to: rptOrders. Delphi automatically
    updates the event declaration for OnPreviewFormCreate event to:

    procedure TForm1.rptOrdersPreviewFormCreate(Sender: TObject);


    You then create two buttons on the form, one to load Report1 and
    preview, the other to load Report2 and preview. When you run the app
    and click Report1, you an error. This is because the Report1.RTM file
    contains a reference to ppReport1PreviewFormCreate, a method which no
    longer exists (at least with this name) in the form.

    One answer is to load all your rtm files into the report component you
    will be using for loading. Fix any errors, reassign any events that get
    cleared. This will update your rtms to contain the proper event handler
    names.


    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.