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

Print Preview

edited April 2003 in End User
Has anybody got any code showing how to manipulate the preview tab on the
main designer window to add say a toolbar to it (Not the designer window).
Also how can I add a menu to main form and make it only available when a
certain is switched to.

--
Regards

Conrad Rowlands
Callards Technology Ltd

Comments

  • edited April 2003
    Conrad,

    You will need to create a descendent of the TppPreview class and make the
    your specific changes using panels and buttons. Follow the link below for
    an example to get you on the right track.

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

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2003
    Here is an example of creating a custom preview. You'll have to implement
    the new toolbar creation logic in your descendent.

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

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2003
    Thanks Nico, that was a great help.

    In the sample you talk about StandardToolbar (in the shift controls
    routine). Unfortunately I do not have a reference for that control. What
    gives?

    --
    Regards

    Conrad Rowlands
    Callards Technology Ltd

  • edited April 2003
    Just a little bit of help on raising events required too, At what point and
    how should I assign event handlers to new controls I have put on my custom
    print preview form. I am getting a lot of exceptions whilst trying to view
    the page once I have assigned onClick handlers. I am using the Viewer
    property of the Report Designer control, Is the correct way to get a ref to
    the custom print preview class?
    Sorry to be a pain...

    --
    Regards

    Conrad Rowlands
    Callards Technology Ltd

  • edited April 2003
    Conrad,

    You will need ReportBuilder 7.02 to run this demo. You can download a trial
    version from our web site at http://www.digital-metaphors.com. If you do
    not want to upgrade, please examine your copy of ppPreview and examine it
    for the changes you need to make for a descendent which will add a button.
    ppPreview has been enhanced from the version you are using.

    Another option is to replace the form itself as shown in the RB Tutorials
    (rbPrvDlg.pas).

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2003
    Hi Conrad,

    You can try using the event handlers in the custom preview form you created.
    If you would not like to do that, you can access those events from your main
    form unit by using the Report.PreviewFormCreate event and using the
    Report.PreviewForm property typecasted as your custom preview form class.
    Something like this...

    procedure TMyform.ReportPreviewFormCreate(Sender: TObject);
    begin
    TMyPreviewForm(Report.PreviewForm).OnSomeEvent := SomeEventHandler;
    end;

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2003
    I tried to do that Nico but the form create was never called. I am using the
    Preview form only in the designer app so does this make any difference?

    --
    Regards

    Conrad Rowlands
    Callards Technology Ltd

  • edited April 2003
    Cheers.

    --
    Regards

    Conrad Rowlands
    Callards Technology Ltd

  • edited April 2003
    Conrad,

    I'm very sorry, I was under the impression you were not trying to do this in
    the designer preview. You will need to create a descendant to TppPreview
    and use that to create your controls and event code. The preview form is
    only created when you call report.print and not from the preview tab of the
    designer.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2003
    Sorry for the misunderstanding, to recap.

    I am using a TPPPreview Descendant in the Designer app for my print
    previews. My question is
    At what point and how should I assign event handlers to these new controls I
    have put on my TPPPReview Descendant. I do not want the logic for these to
    reside in the descendant itself, I want to assign handlers to cope with the
    actions instead..

    --
    Regards

    Conrad Rowlands
    Callards Technology Ltd

  • edited April 2003
    Conrad,

    The TppPreview plugin is created in the Report Designer code as an embedded
    object. If you would like to assign event handlers to it, you would have to
    modify the TppDesigner source. One precaution to note: once you alter the
    source in the 'interface' section of the ReportBuilder source, you will no
    longer be able to use RAP.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2003
    Isn't this a bit of a shortcoming. if you go to the lengths of allowing
    custom print preview components to be used in the designer surely there
    should be some event or similar to allow the addition of handlers. It also
    seems inconsistent with the designer window where controls can be added and
    handlers assigned with no problem at all.

    --
    Regards

    Conrad Rowlands
    Callards Technology Ltd

  • edited April 2003
    The designer creates a registered TppCustomPreview plugin. The preview form
    also creates the same registered TppCustomPreview plugin. Our event handlers
    are located in the plugin class. It used to be that only the TppPrintPreview
    form was replaceable. Then we added the TppCustomPreview plugin architecture
    to let you create it in code if you want, or still replace the form. This
    was done so that you can customize the preview appearance/style in the
    designer preview to match the print preview form.

    Here is an example which shows how to access the preview plugin that is
    created in the designer, via a preview plugin descendent. It is not OO in
    this case and I don't recommend that you use event handlers outside of your
    TppCustomPreview descendent, but if you want to, you can assign them.

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


    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.