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

Disable print button

edited June 2008 in General
Hi! Does anybody know, if it is possible to disable printing? So user
could only see the report.


Best,
Mart



--- posted by geoForum on http://delphi.newswhat.com

Comments

  • edited June 2008
    Hi Mart,

    You can easily set the visibility of the print button in the previewer using
    the PrintButton property of the Report.PreviewForm property.

    uses
    ppPrvDlg;

    procedure TForm1.ppReport1PreviewFormCreate(Sender: TObject);
    begin
    TppPrintPreview(ppReport1.PreviewForm).PrintButton.Visible := False;
    end;

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2008
    Hi Mart,

    Are you using the default preview plugin? If not, you can easily alter the
    plugin code to hide or change any aspect of the preview window you want.
    The code I sent was meant to be used in the OnPreviewFormCreate event which
    fires after Report.Print is called and with the default previewer. In my
    testing with the default RB components, it worked as expected.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2008
    Thanks!

    Unfortunately it doesn't work - on that stage is FPreview nil, so I get
    access violation on row 299 (file ppPrvDlg.pas):

    function TppPrintPreview.GetPreview: TppPreview;
    begin
    if UsingDefaultPreviewPlugIn then
    Result := TppPreview(FPreview)
    else
    Result := nil;
    end;

    FPreview is created in the TppPrintPreview.FormCreate, but FormCreate is
    called only when I do ppReport1.Print.





    --- posted by geoForum on http://delphi.newswhat.com
  • edited June 2008
    Sorry, my mistake. Works very well, if set on the PreviewFormCreate :)

    Thanks again.




    --- posted by geoForum on http://delphi.newswhat.com
This discussion has been closed.