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

Dynamically loaded subreports

edited July 2003 in Subreports
I have used the dynamic subreport loading demo to build my own dynamically
loaded subreport component (I use the subreport component name to load the
template from the DB). However I am having problems when previewing from
inside the designer and I need some clarifications. I do some processing (I
find out which subreports are used and prepare the data) in the BeforePrint
event which fires every time the preview page is activated. However the
AfterPrint event does not fire at all. Is that as it should be (this
behaviour has nothing to do with subreports)?
When are the subreports loaded to the main report and when unloaded? Are
they loaded everytime the preview page is activated and if yes when are they
unloaded? What happens
Finally I tried to hide the Preview tab by setting the TabsVisible=false but
the design tab is hidden as well. This happens when there is a RAP tab
present (I noticed it RB RAP demo as well). Any ideas?

Thanks
Yannis

Comments

  • edited July 2003
    The after print doesn't fire when in the designer. Use the tab change events
    on the designer so that you know when you leave the preview tab. Here is an
    example that uses this technique when going between tabs to find out which
    menus to show.

    http://www.digital-metaphors.com/tips/AddPrintToFileMenuInPreview.zip

    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited July 2003
    Ok Jim I'll try that.
    Any ideas about the rest of my questions? Hiding the preview tab might be a
    bug.
    Thanks
    Yannis

  • edited August 2003
    The subreport loads a template when the report runs, ie. when you preview
    the report. See the source in the subreport descendent you are using. There
    is a line of code where it loads the template from file or database.

    That isn't a bug where TabsVisible = false. See the hlp file. It says that
    the tabs will all be hidden and only the design workspace is shown. Is it
    not showing the design workspace? If there is only the design workspace,
    then it doesn't need a tab control:)

    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited August 2003
    Jim,
    Ok for loading the subreport but when is it unloaded (because it certainly
    is not saved with the main report when I leave the designer and save the
    main report)?
    My problem with tab visibility is that when there is a RAP tab present, this
    is the one that remain visible and the design is hidden.
    Check out the demo "RBuilder\Demos\0. RAP\3. Tutorials". When I set the
    TabsVisible=false the pages Design,Preview,Data are hidden and only the Calc
    is shown.
    Thanks
    Yannis


  • edited August 2003
    Sorry, I misunderstood. If you want to use RAP and not show any tabs, then
    set TabsVisible true. Under the designer's RapOptions property, remove
    riNoteBookTab from the set. Then you don't have any tabs, but if you want to
    code an event handler for a variable, then right click over a TppVariable
    and you'll should see a RAP dialog, as riDialog is in the RapOptions set.
    Remove this option if you only want to use RAP behind the scenes. Also, you
    can remove raIDE from the uses clause and add raCodeModule instead if you
    want RAP linked in, but not the RAP UI.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited August 2003
    Jim,
    Perhaps I have not made myself clear. I have no problem with the RAP tab.
    The only thing I want to do is to hide the Preview tab.
    You suggested a few days back to set TabsVisible=false. But this seems to
    work when there are only the Designer and Preview tabs visible. I use the
    RAP tab as well. Try the demo "RBuilder\Demos\0. RAP\3. Tutorials" after
    setting TabsVisible=false and you'll see what I mean.
    Thanks
    Yannis


  • edited August 2003
    Sorry, you can't hide the Preview tab and still have the Design and Calc
    tabs. You'll have to modify the designer source to support this feature in
    ppDsgner.pas.

    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.