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

Customizing Preview Dialog

edited October 2005 in General
I'm still using the old way of doing this from version 7. Now I've upgraded
to version 9 I believe there is a new way but the tech-tips, help, etc.
still refer to the old way of doing this. Can someone point me to an article
on this.

Ken

Comments

  • edited October 2005
    Hi Ken,

    The process in which you create a custom preview did not change between
    version 7 and 9. The most common way to easily create a custom preview
    dialog that is available still to create a preview plugin.

    -----------------------------------------
    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,

    Thanks for the reply but I also need to be able to add components - can I
    not do this graphically?

    Ken
  • edited October 2005
    Hi Ken,

    I'm a bit confused about what you need. Are you trying to customize the
    preview window or the designer window? If you want the ability to add
    components to a report at runtime you will need to use the TppDesigner
    component available in RB Pro or higher. This window however is very
    limited in the ways you can customize it. Perhaps a little more information
    on what exactly you would like your appliction to do would help me
    understand better.

    --
    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.