TppPrintDialog cancel button
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;
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;
This discussion has been closed.
Comments
using
if lPrintDialog.ModalResult <> mrCancel then
DialogToReport(lPrintDialog, rbOrder) else
result := false;