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

D3 to D6

edited August 2002 in General
Still struggling to move a large project of D3 to D6. Your old
PrintPreview dialog had a bunch of buttons on it. And your tech tips
describe making your own and registering. But the new form is mostly
just a blank form. Was wondering if there was another form/unit I
should be looking at instead that was similar to the old version.
Thanks.

Comments

  • edited August 2002
    You should copy the old implementation of hte preview form and use that to
    replace the form instead of descending from it. The alternative is to use
    the new architecture to create a preview plugin in which you can descend
    from TppPreview and modify the preview that way. I can email you an example
    of replacing the preview using the new architecture if you would like.


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited August 2002
    What I was thinking of doing instead was assigning code to the (new)
    PreviewForm onclosequery event during the onCreatePreviewForm event of
    the Report. Sound ok? I just want to provide a means to ask a
    question and abort the closing of the preview form for a particular
    report.





  • edited August 2002
    Add the following unit to your project if you want to respond to the
    pressing of the close button in your own way:

    unit myPreviewPlugin;

    interface

    uses
    ppPreview;

    type

    {TppMyPreview}

    TppMyPreview = class(TppPreview)
    private
    procedure MyStuff;

    public
    procedure PerformPreviewAction(aPreviewAction: TppPreviewActionType);
    override;

    end; {class, TppMyPreview}

    implementation

    uses
    ppTypes;

    procedure TppMyPreview.PerformPreviewAction(aPreviewAction:
    TppPreviewActionType);
    begin

    if (aPreviewAction = paClose) or (aPreviewAction = paCancel)then
    MyStuff

    else
    inherited PerformPreviewAction(aPreviewAction);

    end; {procedure, PerformPreviewAction}

    procedure TppMyPreview.MyStuff;
    begin
    {do your code}
    end;

    initialization
    TppPreviewPlugin.UnRegister(TppPreview);
    TppPreviewPlugIn.Register(TppMyPreview);

    finalization
    TppPreviewPlugIn.UnRegister(TppMyPreview);
    TppPreviewPlugIn.Register(TppPreview);


    end.

    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited August 2002
    Thanks!
  • edited August 2002
    Assuming I want different (or no code) in PerformPreviewAction
    depending on which report is running, I was wondering what was the
    recommended technique? Thanks.



  • edited August 2002
    When you load a report template, you can register a specific preview class
    if you want at that time. You don't have to place the registration calls to
    unregister.register in the initialization/finalization sections.


    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.