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

Which button is pressed in printpreview?

edited January 2007 in General
Hi,

How can I determine wether the Email-button or the print-button was pressed
in the preview screen?
I need to do some different processing based on the pressed button.

Thank you for your help,
Stef

Comments

  • edited January 2007
    Hi Stef,

    The TppPrintPreview class gives a number of pass thru properties to access
    each button in the preview toolbar. For instance, you can override the
    OnClick event of the email button to determine which button the user
    clicked.

    uses
    ppPrvDlg;

    TppPrintPreview(ppReport1.PreviewForm).EmailButton.OnClick :=
    EmailButtonClickEvent;

    or

    TppPrintPreview(ppReport1.PreviewForm).PrintButton.OnClick :=
    EmailButtonClickEvent;

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2007
    Hello Nico,

    Could you give an example of both buttons where the standard functionality
    of the buttons will remain in tact, but that I add the requested functionality
    to determine which button was pressed?

    Regards,
    Stef
  • edited January 2007
    Hi Stef,

    To take control of each button but leave the current functionality, your
    best bet would be to create a custom previewer. This would give you access
    to all the preview routines so you could use the RB code to do so.
    Otherwise, take a look at the TppPreview.Print and TppPreview.SendMail
    routines. This will show you what code is currently used when these buttons
    are pressed. You will find that these methods are very simple so re-coding
    them in your event handlers should not be an issue.

    --
    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.