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

Disabling the Print Dialog

edited August 2003 in General
Using D7 and RB 7.01

Having trouble disabling the Print Dialog.

Have put

Report.ShowPrintDialog := False;

into the BeforePrint event of my report but it still shows the dialog.

Tried setting in the ppReport component on my form at design time with no
effect either.

Am I going mad??

Regards

Rhonda Ridge
Ab Initio Software

Comments

  • edited August 2003
    try setting it before you call print in the report.


    Paul Menheere

  • edited August 2003
    Isn't that what I am doing by putting it in the Before Print event. I don't
    want to put it into my Delphi code before calling the report as some of my
    users will want the dialog.



  • edited August 2003
    Then why put it into the Beforeprint event.

    To get it to work you should set it before you print it.

    and AFAIK it is also saved in the rtm. file


    Paul


  • edited August 2003
    Could I please have a reply from Digital Metaphors on this please.

    To restate the problem - I want to be able to disable the print dialog when
    the report is printed ie not previewed first. GlobalOnCreate events and
    Before Print all fire after the dialog is displayed when sending output to
    the printer.(NB The events fire in a different order when previewing) There
    is an OnPrintDialogCreate event but that is also too late to set
    Report.ShowPrintDialog := False.

    The only way I have managed to disable the dialog is in my code before
    calling the Print method after loading the template. But this is not what I
    want, I want users to be able to decide if they want to disable the dialog
    on a report by report basis by setting it within the report itself. I can
    find no way of setting this in the rtm file using the setup dialogs withing
    the report itself so that the setting is saves in the rtm file.

    Surely this is quite basic. I would have thought a tick box in the Page
    Setup dialog on the Printer page. Either that or can you tell me which event
    fires first when printing. I have tried using the demos to find this out but
    the event tracker only displays when previewing.

    Thanks
    Rhonda



  • edited August 2003
    Okay read your own story

    You want to let your users set it in the report if they want to have a print
    dialog or not.

    but why do you want to save it in the rtm file. If you change the rtm file
    they have to set it again.

    if you put it in an ini-file or in the registry for what report they want to
    see a Printerdialog.

    Now the following problem ( how can my users set it then ).
    First you rewrite the printerdialog form ( there is an example about that
    somewhere ) where you add a check box ( [] Show this screen the next time
    ? ) or something. when pressing Ok or Print to print the report write the
    value of the checkbox to the ini-file or registry.

    now before you call Print in your program check that file/registry if you
    should show the printdialog and set the property accordingly.


    Paul Menheere
  • edited August 2003
    Hi Rhonda,

    Paul is correct, the reason the print dialog option is not changing is that
    the setting in the template that you are loading is probably different than
    the one you are after. As an alternative, I would try simply adding another
    menu option to the TppDesigner that allows your users to toggle this
    feature. You can edit the menu in the TppDesigner by using the
    TppDesigner.MergeMenu property. This feature allows you to completely
    customize or add on to the existing menu already in the Designer. Check out
    the following example for help or see the ReportBuilder help on the
    TppDesigner.MergeMenu for more information.

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

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2003
    Thanks for reply. I will try your suggestion. I understand why what I am
    trying to do is not working. I am just surprised that this isn't easier to
    achieve. I do feel that a BeforePrintDialogCreate event like the
    BeforeAutoSearchDialogCreate would be a very useful addition. Paul's
    suggestion to store a choice in the registry is something I had already
    considered but as we are talking about an app with hundreds of standards
    reports distibuted with it I quickly dismissed it again.

    Rhonda


  • edited August 2003
    I have followed your suggestion. This was actually far easier than I thought
    and is definately the best solution. I created a new sub menu for the option
    for speed, but will at a later time incorporate this into the File Menu.
    Thanks
    Rhonda


This discussion has been closed.