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

Suggestion - Caption in PrintDialog

edited April 2005 in General
Thank you for at great product !

I have a suggestion concerning the Caption of the Printdialog:

I suggest that CreatePrintDialog initialize?s the Caption to 'Printing
'+PrinterSetup.Documentname
and something according to that in other languages.

I have now made this change in my copy of the sourcecode as you can see
below, but I don't want to remember to do this again if and when am
upgrading.

function TppProducer.CreatePrintDialog: TppCustomPrintDialog;
...
begin
...
lPrintDialog.Init;
lPrintDialog.Caption:= 'Udskrift af '+PrinterSetup.Documentname;
Result := lPrintDialog;
end; {procedrue, CreatePrintDialog}


I know I could accomplish this by using the OnPrintDialogCreate-event, but
first of all I would have to do this in all reports of all applications, and
furthermore I would have to ensure that saved report-templates gets this
event if it does not have it.

Ren? / SSV



--

Comments

  • edited April 2005
    Hi Rene,

    Thanks for the suggestion. However ReportBuilder was designed so that every
    dialog (with the exception of the Designer) is completely replacable and
    customizable. For an easier solution, you could create a custom print
    dialog with the caption changed and register it as the default print dialog
    to be used with any ReportBuilder version. See the following article for
    more information.

    ------------------------------------------------------------
    Tech Tip: Replacing Built-in Dialogs/Forms in ReportBuilder
    ------------------------------------------------------------

    ReportBuilder has an open architecture for replacing any of the built-in
    dialogs. You can replace any of the built-in dialogs by creating a new form
    that inherits from an abstract ancestor and then registering it as the new
    built-in dialog.

    For example to replace ReportBuilder's print dialog you could

    1. Create a new Print dialog by renaming ReportBuilder's default print
    dialog, then doing a SaveAs to save it under another unit name.

    The default dialog resides in RBuilder\Source\ppPDlg.pas and the form is
    called ppPrintDialog. You should assign your form a unique name, for
    example, myPrintDlg, and save the unit to another name. Also save the unit
    to the directory where your other forms are stored (not RBuilder\Source).

    2. Make desired changes.

    You will notice that the print dialog inherits from an ancestor
    TppCustomPrintDialog - this ancestor resides in ppForms.pas (where all the
    abstract ancestor forms for ReportBuilder are defined).

    3. Register the new form.

    Declare an initializtion section at the bottom of the unit:

    initialization

    ppRegisterForm(TppCustomPrintDialog, TMyPrintDialog);


    4. Add the new unit to your project and compile.

    Now your preview dialog should be automatically created and destroyed by
    ReportBuilder. The two page preview dialog in the
    RBuilder\Demos\Reports\Demo.dpro was created this same way. The only
    difference is the ppRegisterForm call is in then OnClick event of the
    button.


    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2005
    Thank You !!
    Excellent solution ! I didn't realize how easy it was to do this !

  • edited April 2005
    > Thanks for the suggestion. However ReportBuilder was designed so that
    every
    dialog

    One thing though....
    How do I refer to the actual Report ..... ?
  • edited April 2005
    Hi Rene,

    The TppForm class contains the public property "Report". Typecasting this
    property as a TppReport should give you access to the report.
    (TppCustomPrinterDialog is a descendent of TppForm).

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.