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

Custom Previewer Questions

edited August 2003 in General
Two questions:

1. I am using Digital-Metaphors's sample MyPreviewPlugin.pas as a basis to
create a custom previewer. I am needing to add a button to the custom
previewer that the user can click which will display a listbox of color
choices. When the user selects a specific color from this list I want to
then change the color of all TppLabel Font color properties for the report
being previewed and then refresh the preview to show the report with the
new color. What is the best way to access the underlying report that is
being previewed via plugin code in order to gain access to these TppLabel
components and how to you "refresh" the previewer once the font properties
are changed?

2. I have several reports in my application but only want to display this
custom previewer for two reports. I want all other reports to display the
default previewer. Is there a way to register and unregister the plugin
based on what report the user chooses?

Thanks,
Steve Swarner

Comments

  • edited August 2003
    It wasn't as hard as you may think. All you have to do is update the page
    that is sitting on the current screen device and then update the repor
    tobject so that when the next page is requested, it will be in the right
    color automatially.Below is an example I threw together today for you.
    Notice I use a template to make sure I don't overwrite the original color.
    Also, see that you can make the register call for a given preview around
    each call to Report.Print if you would like. You could also use the
    Report.Template.OnLoadEnd event if you want to check the report name the
    user loaded to make the register call then. Then you could also add a field
    to the rbItem end user table to add a field which was the name of the
    preview class that should be shown for each report in the database.

    RB 7.02 and D6 format using DBDemos BDE data.

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


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited August 2003
    Thanks very much Jim. Your explanation and example was very helpful.

This discussion has been closed.