TppPrinterDialog access violation
When I try to open it
lPrintDialog := TppPrintDialog.create(self);
lPrintDialog.AllowPrintToArchive := false;
lPrintDialog.allowprinttofile := true;
lPrintDialog.DeviceType := dtScreen;
lPrintDialog.LanguageIndex := 7;
pp_report.printer.printername := nome_stampante;
lPrintDialog.printer := pp_report.printer;
lPrintDialog.textfilename := pp_report.textfilename;
//lPrintDialog.btnPrinterProperties.enabled := false;
lPrintDialog.rdbCurrentPage.enabled := false;
lPrintDialog.rdbPages.enabled := false;
lPrintDialog.edtPageRange.enabled := false;
lPrintDialog.edtPageRange.color := clBtnFace;
lPrintDialog.cbxPrintWhat.enabled := false;
lPrintDialog.cbxPrintWhat.color := clBtnFace;
if lPrintDialog.ShowModal <> mrOk then
I receive an access violation
lPrintDialog := TppPrintDialog.create(self);
lPrintDialog.AllowPrintToArchive := false;
lPrintDialog.allowprinttofile := true;
lPrintDialog.DeviceType := dtScreen;
lPrintDialog.LanguageIndex := 7;
pp_report.printer.printername := nome_stampante;
lPrintDialog.printer := pp_report.printer;
lPrintDialog.textfilename := pp_report.textfilename;
//lPrintDialog.btnPrinterProperties.enabled := false;
lPrintDialog.rdbCurrentPage.enabled := false;
lPrintDialog.rdbPages.enabled := false;
lPrintDialog.edtPageRange.enabled := false;
lPrintDialog.edtPageRange.color := clBtnFace;
lPrintDialog.cbxPrintWhat.enabled := false;
lPrintDialog.cbxPrintWhat.color := clBtnFace;
if lPrintDialog.ShowModal <> mrOk then
I receive an access violation
Comments
and there are printers
P-Soft
web: https://www.p-soft.biz
Firebird Foundation Commitee Member
The printer dialog is not designed to be created as a stand-alone option. If you would like to only display the printer dialog, you can simply set the DeviceType property of the report to "Printer" and the print dialog will display when calling Report.Print.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I use this code from 2010 and I never had problems. Just now when I upgrade latest RB version for Delphi Alexandria
P-Soft
web: https://www.p-soft.biz
Firebird Foundation Commitee Member
The printer dialog has gone through a number of major changes since 2010. Please explain what you are trying to accomplish with your application and I will try to find a solution with the current architecture.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
1. print preview
2. print to printer
3. send by mail (with pdf attachment)
this is a generic form use to inherited all printer form.
If use rchoose 2 case usually I open printer dialog where user can
. choose a printer (from compuer instaleld printers)
- choose to print to
- file
- excel (raw data or report like)
- csv, txt
- PDF
- and so on...
P-Soft
web: https://www.p-soft.biz
Firebird Foundation Commitee Member
Thanks for the clarification. The print dialog is designed to print reports only so using in this way may cause problems in the future as we enhance the feature.
For now, you need to make a call to TppPrintDialog.Init before showing the dialog to initialize the new high DPI image lists. This is generally necessary with all ReportBuilder dialogs.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
P-Soft
web: https://www.p-soft.biz
Firebird Foundation Commitee Member