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

Calling ShowPropertiesDialog

edited April 2004 in General
Hi,

I have a program that allows you to select the printer.
It then creates and runs a report. Next to the printer
dialog box I put a 'Properties button which calls:

MyReport.Printer.ShowPropertiesDialog;

This all looks like it works fine. When you print you
get the print dialog that also has the same 'Properties'
button.

Now, if I press my button and set the printer to staple
it looks right but does not staple. If I press the button
on the print dialog and set the printer to staple, it works
right. I have tracked it down to the PrintToPrinter
routine in the ppProd unit. In that routine you
create a new FPrinterDevice and copy over the
PrinterSetup. When it creates the FPrinterDevice it
also creates a new Printer with a new PrinterHandle.
It seems like the extra things like staple are attached
to this printer handle. If I comment out the code that
creates this PrinterDevice (and the code that frees it
later) it works. I would think a better solution would
be to not create a new printer handle but unfortunately
the PrinterHandle is a read-only value.

I did not see a downside to commenting out the create
of the FPrinterDevice. If I understand the code it is
made so that the SavePrinterSetup works. Any insight?

Thanks,
Joseph Gordon

Comments

  • edited April 2004

    -------------------------------------------------
    Tech Tip: Configuring Printer Specific Options
    -------------------------------------------------

    The Report.PrinterSetup properties can be used to set the properties that
    are common to all printers. Internally RB applies these to the Windows
    DevMode structure.


    Report.PrinterSetup <----> Windows DevMode <-----> Printer Driver <--->
    Printer


    Printers often contain additional features, such as output bins, media
    types, etc. The Windows DevMode structure can contain a private area that is
    used the printer driver to store printer specific options. These can be
    configured by using the Printer Driver's built-in properties dialog. These
    options can theoritically be set programmatically, the trick is that you
    have to know where in the structure to store the option and what values are
    valid.

    The following example shows how to display the printer properties dialog and
    save the devmode for use within RB...

    http://www.digital-metaphors.com/tips/SavePrinterDevMode.zip


    --
    Tech Support mailto:support@digital-metaphors.com
    Digital Metaphors http://www.digital-metaphors.com




    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com


    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited April 2004
    Hi,

    That works much better than my solution.

    Thanks,
    Joseph Gordon



This discussion has been closed.