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

an easier example?

edited July 2005 in General
Hi;

im trying to create a custom preview form, that allows the user to chose the
output device for the report. im trying to follow the example on the
tutorial/demos directory, but to be honest, i can understand it. is there
another step-by-step procedure that i can follow to do that?


TIA

Comments

  • edited July 2005
    Hi Arturo,

    Take a look at the following example and article. They should get you on
    the right track with creating a custom preview form.

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

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

    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 July 2005
    Thanks Nico...

    finally i was able to deal with the tutorial's example, and i included the
    rbPrvDlg.pas unit on my project, i even changed the lay out and added some
    buttons to the form, but; on one of the buttons, i need to let the user to
    choose the device to print out the report (printer or file).

    On the onclick event of that button, i changed the DeviceType,
    AllowPrinttoFile,ArchiveFile properties, but even i noticed (debugging the
    code) that event is executed w/o problems, when i click on the printer
    button (ppviewer.report.print), the print dialog shows the "Print to File"
    checkbox uncheked, and sends the report to the printer.

    Any idea to solve this?

    TIA


  • edited July 2005
    Hi Arturo,

    If you want the PrintDialog to reflect the changes you've made after the
    report has already generated once, you will need to chang the PrintDialog
    properties.

    For instance...

    myReport.PrintDialog.AllowPrintToFile := True;

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