Problem selecting dtScreen or dtPrinter at runtine
This should be easy. . .
I have a print module that loads one of two templates on FormActivate:
ppReport1.Template.LoadFromFile; // Works fine. . .
I'm trying to direct the output to the screen or printer at runtime, so I'm
a bit stumped why this doesn't work:
Memo1.Lines.Add('DT: ' + ppReport1.DeviceType); // Just a visual check
ppReport1.DeviceType := 'dtScreen';
ppReport1.PrinterSetup.Printername := 'Screen'; // (Tried for the heck of
it. . . )
Memo1.Lines.Add('DT: ' + ppReport1.DeviceType); // Does not show change -
goes to printer
This goes to the printer based on the settings in the template. What am I
missing? What else do I need to do to set the output at runtime?
Thanks,
Madt M.
I have a print module that loads one of two templates on FormActivate:
ppReport1.Template.LoadFromFile; // Works fine. . .
I'm trying to direct the output to the screen or printer at runtime, so I'm
a bit stumped why this doesn't work:
Memo1.Lines.Add('DT: ' + ppReport1.DeviceType); // Just a visual check
ppReport1.DeviceType := 'dtScreen';
ppReport1.PrinterSetup.Printername := 'Screen'; // (Tried for the heck of
it. . . )
Memo1.Lines.Add('DT: ' + ppReport1.DeviceType); // Does not show change -
goes to printer
This goes to the printer based on the settings in the template. What am I
missing? What else do I need to do to set the output at runtime?
Thanks,
Madt M.
This discussion has been closed.
Comments
For the DeviceType property, do not use dtScreen as a string, simply use the
string "Screen".
ppReport1.DeviceType := 'Screen';
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
(But help clearly lists dtScreen an dtPrinter as values, so I'm just a
little less confused. . . )
Yes, it is a bit confusing. The constants dtPrinter, dtScreen, etc. are
given to provide backward compatibility and an easy way to define the
built-in devices. These however are constants and should be referred to
directly.
uses
ppTypes;
ppReport1.DeviceType := dtPrinter;
I will see about updating the help for this topic for the next release.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com