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

ppPrvDlg?

edited August 2006 in End User
I was going to customize the print preview dialog but I think the source
code i have is incorrect. I saw in the developers guide that you have to
open ppPrvDlg.pas. This is a blank form with no components on it? Do I
need to download the source from somewhere or am I looking at the wrong
file?

Thanks All,
Branden Johnson

Comments

  • edited August 2006
    Hi Branden,

    The current preview dialog is mostly created in code. This is the reason
    you do not see any components on the PrvDlg form. The preferred way to
    replace the preview dialog is to create a preview plugin. Take a look at
    the following article on how this is done. Also, if you would like to see
    all the components that are currently used in the preview, take a look a the
    ppPreview.pas file.

    -----------------------------------------
    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
This discussion has been closed.