How to interrupt a PrintDevices command ?
Hello All,
In one unit of an application, I use several "ppReport.PrintDevices"
commands.
Some of those commands can take between 15 and 20 seconds in order to
complete.
If during the execution of a PrintDevices command, the user closes the Form,
the programs hangs with the error "Access Violation" or "External Error" or
"Abstract error" ...
Is it not a way to manage the unattended interruption of the PrintDevices
command.
I try to surround the command with a "try except" with no result.
I also try to use the OnCancel event of the ppReport also no result .
Thanks for your help.
Claude
In one unit of an application, I use several "ppReport.PrintDevices"
commands.
Some of those commands can take between 15 and 20 seconds in order to
complete.
If during the execution of a PrintDevices command, the user closes the Form,
the programs hangs with the error "Access Violation" or "External Error" or
"Abstract error" ...
Is it not a way to manage the unattended interruption of the PrintDevices
command.
I try to surround the command with a "try except" with no result.
I also try to use the OnCancel event of the ppReport also no result .
Thanks for your help.
Claude
This discussion has been closed.
Comments
Try using the Report.Printing property to restrict your users from closing
the application before the report has finished printing. You can also try
using the before and after print events to be sure the report has completed
printing (setting flags in your own code).
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Another option would be to use the Report.Cancel routine to stop report
generation before the form is closed.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I do not find any Report Printing property or even a Printing property of a
TppReport ?
Where is it ?
On the other end, I don't know what you mean with the flags in the code ??
How can I trap something happening during a printing with an event that take
place before the print or after the print ??
Regards,
Claude
Which version of ReportBuilder and Delphi are you using?
TppReport.Printing is a runtime only boolean property of the ancestor class
TppProducer. You can only access in in code and it will tell you if the
report is in the process of printing. My initial thought was that you could
prevent your users from closing the form while this property was True.
The flag method was the same as above. You create a boolean property of
your own (say FPrinting) and set it to True in the BeforePrint event of the
report. Set it back to False in the AfterPrint event. Now only close the
form if FPrinting is False.
These methods however may not be the best solution as your users may simply
just want to quit the application while printing a report. In this case,
you can call Report.Cancel which will tell the device to finish printing
before the application is closed. This is the same as hitting the "Cancel"
button in the preview window.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I use Delphi 2007 and ReportBuilder 10.9.
Regards,
Claude