Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Problem selecting dtScreen or dtPrinter at runtine

edited May 2007 in General
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.

Comments

  • edited May 2007
    Hi Madt,

    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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2007
    Thanks Nico!

    (But help clearly lists dtScreen an dtPrinter as values, so I'm just a
    little less confused. . . )



  • edited May 2007
    Hi Madt,

    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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2007
    OK, now I get it. . . .

This discussion has been closed.