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

How to catch the [OK] click in the print dialog event

edited July 2006 in General
Hi all,

I am using Delphi 7 and RB 9.

How can I catch the event for the [OK] click on print dialog?

What I would like to do is this:
* The user click Print in my app.
* The report is set to DeviceType := Screen, so the report shows up on the
screen.
* The user looks at the report and chooses to print the report. He clicks
the printer icon
* The PrintDialog shows up
*** Now I would like to catch the click on the [OK] button

The reason for this is that everytime the user prints a report, I need to
store a copy of that exact report in the DB (InterBase using IBObjects) as a
PDF file.

If the user clicks the [Cancel] button in the print dialog, the report
should not be stored in the DB.


I hope you can help me, thank you in advance

/Claus

Comments

  • edited July 2006
    Hi Claus,

    ------------------------------------------
    Tech Tip: Detecting whether PrintDialog's
    Cancel button was Selected
    ------------------------------------------

    When the print dialog is displayed to the
    user, you can determine whether the Cancel
    button was selected by using the
    Report.OnPrintDialogClose event.

    Example:

    procedure TForm1.ppReport1PrintDialogClose(Sender: TObject);
    begin

    if ppReport1.PrintDialog.ModalResult = mrCancel then
    ShowMessage('Use chose to cancel the print request');

    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.