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

TppPrintDialog cancel button

edited September 2002 in Devices
I apologize for posting this a second time in the same group but I feared
that the thread I tagged it too may have been so old that it might not
appear on the radar screen. I am trying to get this turned in by tomorrow.

I have studied the code in the ppPDlg unit and shy of modifying the
component, I have not been able to make this work.
Is it necessary that I modify this component?
I am using the code you suggest and it works great except for one thing - if
the user selects (Cancel) in the PrintDialog box, the document is still
printed. I tried pulling in the procedure
TppPrintDialog.btnCancelClick(Sender: TObject) event but
am not successful. Can you give me a clue in how to do this?

TIA


uses
ppPrintr;

procedure TForm1.Button1Click(Sender: TObject);
var
lPrintDialog: TppPrintDialog;
begin

lPrintDialog := TppPrintDialog.Create(Self);
lPrintDialog.AllowPrintToArchive := True; <--
lPrintDialog.AllowPrintToFile := True; <--
lPrintDialog.Printer := ppReport1.Printer;

lPrintDialog.ShowModal;

DialogToReport(lPrintDialog, ppReport1);

lPrintDialog.Free;

ppReport1.ShowPrintDialog := False;
ppReport1.SavePrinterSetup := True;
ppReport1.Print;

end;

procedure TForm1.DialogToReport(aDialog: TppPrintDialog; aReport:
TppReport);
begin
aReport.DeviceType := aDialog.DeviceType; <--
aReport.PrinterSetup.Assign(TppPrinter(aDialog.Printer).PrinterSetup);
end;

Comments

  • edited September 2002
    Figured it out:

    using

    if lPrintDialog.ModalResult <> mrCancel then
    DialogToReport(lPrintDialog, rbOrder) else
    result := false;

  • edited September 2002
    "Larry Killen" wrote in message
  • edited September 2002
    "Mike Leftwich" wrote in message
This discussion has been closed.