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

Problem building custom preview

edited December 2003 in General
Hi,

I am using 6.03 standard.

I try to build a custom preview form since the default one does not have a
save button.

I read the tutorial and follow the section in 'Building a Report
Application|Create a Customized Print Preview Form'.

I open the ppPrvDlg unit. But I am stuck at step 5 of the section. This is
the statement in the section:
'Select the panel at the top of the form (named pnlPreviewBar).

But the form (TppPrintPreview) has no panel at the top. In fact, it is a
blank form with nothing. There is only one item, the form, in the object
inspector. And I can see there is some kind of plugin going on in the
FormCreate event.

Is the tutorial not up to date or I did something wrong?

Thanks,
Ping Kam

Comments

  • edited December 2003
    -----------------------------------------
    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.


    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2003
    Thanks,
    Ping Kam
This discussion has been closed.