Página 1 de 1

Printer and TPrinter

Publicado: Mié Ago 30, 2017 6:47 pm
por emeasoft
Good afternoon,

When you create an object of the TPrinter class and change the nPrinterIndex parameter, even after you call the Destroy() method,
the nPrinterIndex parameter of the public variable Printer also changes.
This causes the printer selected by default in the print dialog window to be the last printer selected with the TPrinter object.
If after destroying the TPrinter object ( TPrinter:Destroy() ), you also destroy and recreate the public variable Printer ( Printer:Destroy() and Printer:Create() ),
the printer selected the next time you print, returns to be the default.
The question is, when creating an object of class TPrinter, changing its parameters and then destroying it, the instance of the public variable Printer should also be changed?

Thanks,

André Corrêa

Re: Printer and TPrinter

Publicado: Mié Ago 30, 2017 8:23 pm
por jfgimenez
André,

most TPrinter propierties are sent to windows print subsystem and printer driver. That's why changing those properties in a TPrinter instance is propagated to others. So, I'm affraid the programmer is responsible of restoring those values after printing.

Re: Printer and TPrinter

Publicado: Vie Sep 01, 2017 1:02 pm
por emeasoft
Thank you Gimenez.