Please, could u test this?
On the TppReport.OnPrintDialogCreate, I call ppPrinters.Refresh().
- Choose my printer
- Selected Pages: 1-2 (not 1;2),
-Click OK.
I get an Access Violation on page printing. if any of you meet this error,
please let me know. When I comment the line, everything runs fine.
David
- Choose my printer
- Selected Pages: 1-2 (not 1;2),
-Click OK.
I get an Access Violation on page printing. if any of you meet this error,
please let me know. When I comment the line, everything runs fine.
David
This discussion has been closed.
Comments
Sorry for the delay in this response, my news reader originally did not pick
up on this post.
In my testing, placing the call "ppPrinters.Refresh;" into the
OnPrintDialogCreate seemed to work correctly. What else are you doing
inside this event? If you trace into the Refresh code, which line is the AV
occuring on? Do you have any printers installed to this machine?
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I was wrong. It's not in the OnPrintDialogCreate, but in the
TppReport.BeforePrint event. Here is my code:
procedure TFormMain.ppReportMasterBeforePrint(Sender: TObject);
begin
//ppPrinters.Refresh(); // COMMENTED
if (ppReportMaster.FileDevice <> nil) then
begin
if (ppReportMaster.FileDevice is TppReportTextFileDevice) then
begin
TppReportTextFileDevice(ppReportMaster.FileDevice).CharacterGrid(130, 66);
end;
if (ppReportMaster.FileDevice is TppTextFileDevice) then
begin
TppTextFileDevice(ppReportMaster.FileDevice).TextFileType :=
ftComma;
end;
end;
end;
After the report begins to print, the TppPrinter.GetPrinterSetup method is
called numerous times and it appears that the BeforePrint event is fired in
between some of these calls, causing the papernames list to reset and give
you the AV. You will need to move this call to another event, preferably
before the BeforePrint event is fired.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
It's good to see I'm not completely fool.
David