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

Embedded Designer

edited December 2011 in End User
Hello

I want to launch the Designer from the Report Explorer (i.e standard End
User setup), but then have it embedded in a custom form using
Tpp.Designer.ShowInPanel. But all the Open, New etc methods of
TppReportExplorer call FDesigner.ShowModal, which somewhat goes against the
grain :)

Can anyone thing of a way around this?

Paul Toms - Navigator Systems Ltd

Comments

  • edited December 2011
    Hi Paul,

    The easiest option would be to create and register a custom
    ReportExplorer form that overrides the Open, New commands. An example
    of creating a custom explorer can be found in the Tutorials as well as
    the following article.

    http://www.digital-metaphors.com/rbWiki/End-User/Report_Explorer/How_To...Add_a_PDF_button


    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2011
    OK, the only way I can think of to get around it is to :

    i) Double subclass TppReportExplorer in my EndUser form:

    TnavReportExplorer = class(TppReportExplorer)
    public
    procedure Open(const aReportName: String; aFolderId: Integer); override;
    end;

    TppReportExplorer = class(TnavReportExplorer);

    ii) Comment out FDesigner.ShowModal in the procedure
    TppReportExplorer.Open

    -- I'd really rather not touch any of the RB code at all :(

    iii) Implement TnavReportExplorer.Open() thus:

    procedure TnavReportExplorer.Open(const aReportName: String; aFolderId:
    Integer);
    var lHostForm : TForm;
    lIntf : InxDesignerHost;
    begin
    inherited;

    lHostForm := FormsManager.findForm('TnxRBDesignerForm');

    if assigned(lHostForm) then
    if lHostForm.GetInterface(InxDesignerHost, lIntf) then
    begin
    lIntf.Designer := Designer;
    Designer.ShowInPanel(lIntf.HostPanel);
    Designer.Form.MainMenu.CurrentDock.Parent := lHostForm;
    end;
    end;

    I works, but needs this tweak to the RB source. So if anyone has any better
    ideas......TIA :)


  • edited December 2011
    Hello Nick

    I already do that for other purposes, but the Report Explorer custom FORM is
    not the issue: its the TppReportExplorer class that the form refers to. When
    I check out all the code in TppReportExplorer for all sorts of other stuff
    I'm loath to take the Explorer Form off at a tangent because there is loads
    of Private code in the TppReportExplorer that is called in the Public
    methods it exposes for the Explorer Form, if you see what I mean. I've just
    posted a workaround in reply to myself. I'd appreciate your comments on
    that. Thanks.


  • edited December 2011
    Hi Paul,

    The TppReportExplorer is more or less a helper class. The idea behind a
    custom Report Explorer form is that it gives you complete control over
    what occurs when the user interacts with the explorer.

    For instance, when overriding the Design routine of the Explorer Form,
    instead of making calls to the TppReportExplorer, you could simply load
    the selected report yourself and instantiate your embedded designer. To
    make things easier, TppReportExplorer.LoadReport can be used.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2011
    Thanks Nico

    I've followed your advise and made it work by:

    i) overriding the ehFileDesignClick() event in my decendent class and doing
    my own Design routine in that
    ii) reassigning the ListView.OnDoubleClick along the lines of...
    TnavReportExplorerForm(ReportExplorer.Form).ListView.OnDoubleClick :=
    TnavReportExplorerForm(ReportExplorer.Form).ehFileDesignClick;

    However, I'm not sure about doing the same with the
    TppReportExplorerForm.ehFileNewReportClick() method because this calls
    FReportExplorer.New() and when I look at that there is a lot of Private code
    that runs which looks quite important, particularly,

    FReport.Template.DatabaseSettings.Name := (aFolderId);

    ConfigureReportTemplate;

    Any advice of how to proceed "safely". TIA,

    Paul


  • edited December 2011
    Hi Paul,

    To access the Report object, you could use the Explorer.Designer.Report
    property.

    As for the ConfigureReportTemplate routine, you would need to move this
    code to your custom report explorer along with all the event code
    assigned inside the routine.

    Which version of ReportBuilder are you using? If it will help, I can
    make the ConfigureReportTemplate routine public for the next release.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2011
    Hello Nico


    Oh that's a bit OOT. I like your you second suggestion below better :) If
    you can get that into 14.2 (or an interim release) I'll hack the source code
    temporarily to promote ConfigureReportTemplate to public so that I can move
    on.


    I'm on 14.1. That would be great.

    Can I just say, I've been a RB user since v6, upgrading to v7, v10 and now
    v14, and a big congratulations to the team on all the improvements that come
    with the new version: I love it :). But the issue of the Report Explorer and
    how to customize it has always been a problem for me. In previous versions
    I've just hacked the code mercilessly, but with v14 I'm determined not too.
    But its an uphill struggle. I can see that the RB team certainly have made
    lots of effort in the design to help PITA people like me, but its taken me
    days and days to devise solutions, with many hours trawling your code ,
    checking out the WIKI and searching the NGs for tips. For future development
    I would suggest that a complete API be devised and published for the Report
    Explorer: because although it doesn't offer all the hard core features that
    you get in the Designer itself, its a critical route to how our users will
    access the Designer or interfaces for configuring reports. Don't wish to so
    sound like I'm moaning, because I really am a huge RB fan: just wish this
    bit was easier :)

    Paul
  • edited December 2011
    Hi Paul,

    Thanks for the feedback and kind words. I will make the
    ConfigureReportTemplate property public for the next release. Moving
    forward we will continually try to make the customization of the
    ReportExplorer easier.

    Best Regards,

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