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

Custom Print Preview

edited March 2003 in Devices
No doubt this question has been asked many times. I want my own report
preview form. The Dev Guide has instructions that are obsolete. Ditto for
the Tech Tips ng post. And I'm sure I'm just tired and suffering severe
brain fade.

Does anyone have a small app or concise instructions about how to do this? I
want to register my preview at app startup and keep it for the duration --
no switching, no buttons -- real simple.

TIA and may you enjoy warm, sunny weather, Steve

Comments

  • edited March 2003
    Yes, we did change the architecture and need to update the Developer's
    Guide. However, the old approach still works where you can replace the
    preview form. Take a look in the installed
    RBuilder\Tutorials\Complete\II.Applications\01.Reporting\ In here you will
    find the rbPrvDlg.pas which is a custom preview form that is created
    visually. You can use this as a basis for which you can create your custom
    preview form. See the register calls at the bottom of that unit. You can run
    this tutorial project to see it in action.

    The only problem with this approach is that the designer preview will not
    change. So, the new way to do it is by creating a TppPreview descendent.
    Here is an example of customizing the preview form via the TppPreview plugin
    architecture:

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

    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited April 2003
    I added HidePrintButtonPlugin to the uses clause in the module where it
    needs to be applied. Now the entire app can not print from preview. Why?

  • edited April 2003
    Yes, that is what will happen. What you need to do is conditionally register
    and unregister the plugin for each report. Move the registration call from
    your initialization section of your plugin to a new place. Do you know the
    name of a report that you don't want to print? Are you just calling
    Report.Print in code and not using templates? If so, then place the register
    call before the call to Report.Print and then register the TppPreview after
    the Report.Print call. If you are using the end user solution, then assign
    and use the public Report.Template.OnLoadEnd event to check the report name
    to see if this is a report that you want to use this custom plugin. If it
    is, then register the custom plugin class otherwise, register the default
    TppPreview class.

    --
    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.