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

Custom previewer

edited September 2005 in General
I think were on report builder v9.2, Delphi 6, using Advantage database.
What has happened to the custom preview examples that used to be in rb v6x..
The examples dont seem to be there any longer from the installation. Is
there any, and if so how do we get to them. Many thanks Antony

Comments

  • edited September 2005
    Hi Antony,

    There is now a new archetecture in place to create a custom preview in your
    applications. See the article below for information on creating a preview
    plugin. If you would like to see an example of the "old" way of replacing
    the preview form, take a look at the tutorial example located in the
    \RBuilder\Tutorials\Complete\II. Applications\01. Reporting\... directory.

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

    Q: I've followed the tutorials and registered a Preview Form replacement but
    that did not affect the TppDesigner's Preview workspace.


    A: Do not use the form replacement, but rather, there is a different
    architecture built into the preview form that is registered by default.



    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
  • edited October 2005
    Nico

    We now have a bright red form.

    How do we add an extra button to the Standard toolbar so we can email the
    report?

    ppPreview states

    @TppPreview.StandardToolbar

    Contains the preview controls for the page setting and the page
    navigation
    controls. The autosearch and text seach buttons are also located in this
    toolbar. Use this toolbar if you want to add controls in a TppPreview
    plugin
    descendent


    but how????

    Sorry to be thick but we are well outside our confort zone and have no
    experiance of override and other such commands and are basically stumbling
    along in the dark. Is there a more extensive custom preview form example
    we can use to get ideas from?

    I have searched Tamaracka.com for other clues. Judging by the number of
    similar cries for help on this subject and the time it must take you to
    create each reply, a detail project could save you considerable time.

    Thanks in advance.


  • edited October 2005
    Hi Philip,

    Take a look at the following example of adding a new button to the preview
    window in order to alter the print settings...

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

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2005
    Thank you - would never have got anywhere near without your help.

    Regards

    PLJ
This discussion has been closed.