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

BeforeGroupBreak on Groups never fires

edited August 2004 in General
Hi

Im using RB 7.02
D7 and have the following problme

I load a template dynamically , and find the Tppgroup component on the
template and wire up the BeforeGroupBreak event to a procedure.

the problem is the BeforeGroupBreak never fires ?

Wheni wire up OnGetBreakValue to aprocedure and display the value of
aBreakValue
it shows that the Value definatley changes, and thus the BeforeGroupBreak
should fire , but it doesnt.

Any clues ?

Comments

  • edited August 2004
    Hi,

    --------------------------------------------
    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.


    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2004
    Nico

    This is not the case.

    We are not using this method of connecting the event.


    what we do is :

    Load the template (rtm) , into a ppReport
    then search the comonponents for a specific Component, i.e the Group
    component, and then wire up the BeforeGroupBreak to a method in the current
    form.

    Ans it does not fire.

    But when we wire up the OnGetBreakValue it does fire this event, so we
    have identified the correct Component in the rtm.

    On checking the values of OnGetBreakValue , the groups do change , and thus
    i would assume that BeforeGroupBreak should fire.


    Regards

    Ian Robinson





  • edited August 2004
    Hi Ian,

    Looking at the source, the only reason this event would not fire is if the
    GroupHeaderBand is not visible. the BeforeGroupBreak event relies on the
    GroupHeaderBeforePrint event to fire correctly. Likewise the
    AfterGroupBreak event needs the GroupFooterBand to be visible as well. You
    can take a look at the source where these events are called in the
    ppClass.pas file inside the TppGroup.GroupHeaderBeforePrint procedure.

    --
    Best Regards,

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