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

Adding buttons for certain reports

edited October 2007 in End User
Hello

Our application has several reports

Is there a way to add buttons to the viewer for certain reports only? The
method suggested in your articles seems to involve creating a descendant
class of TppPreview which is created in the initialization of the unit

I am using Report Builder 10.07

Cheers

Paul

Comments

  • edited October 2007
    Hi Paul,

    Yes, the easiest way to accomplish this would be to create a custom Preview
    plugin that contains the added buttons for certain reports. Then, based on
    which report template is loaded, register or unregister the proper preview
    plugin to show or hide the buttons.

    Take a look at the ppPreview.pas file for how the original previewer is
    made.

    -----------------------------------------
    Article: Creating a Preview Plugin
    -----------------------------------------

    You will need to register a TppPreview descendent. The class you register
    is used to create the preview controls inside the standard print preview
    form and the designer preview workspace.


    Here is an example of creating a simple custom preview that access the
    viewer its been assigned in order to change the page color. You can also do
    more advanced operations such as adding and removing buttons and change the
    behavior of the preview form. Access the inherited controls via. protected
    properties and override the virtual methods in order to customize behavior.

    Open ppPreview.pas and view the TppPreview class as a guide to create a
    custom preview descendent.


    unit MyPreviewPlugin;

    interface

    uses
    ppPreview;

    type
    TMyPreviewPlugin = class(TppPreview)
    public
    procedure BeforePreview; override;

    end;


    implementation

    uses
    Graphics;


    procedure TMyPreviewPlugin.BeforePreview;
    begin
    inherited BeforePreview;

    Viewer.PageColor := clRed;

    end;

    initialization
    TppPreviewPlugIn.Register(TMyPreviewPlugin);

    finalization
    TppPreviewPlugIn.UnRegister(TMyPreviewPlugin);

    end.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

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