Home General

Hyperlink from Image

edited January 2016 in General
Hi

Delphi XE7 and RB 16.03 Ent.

Is it possible to hyperlink from an image and if so how?

Regards

Tim Murfitt

Comments

  • edited January 2016
    Hi Tim,

    You can use the OnDrawCommandClick event to perform a task when an
    TppImage is clicked. The following would be similar to the way the
    HyperLink property works for text components.

    uses
    ppUtils;

    procedure TForm1.ppImage1DrawCommandClick(Sender, aDrawCommand: TObject);
    begin

    ppShellExec('http://www.google.com', '', '', SW_SHOWNORMAL);

    end;

    Best Regards,

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

    Thanks for that. I can see that will work but i am loading the report from
    a template file and am using RAP where ppShellExec is not available to me.
    Do i have to create a pass through function or is there another solution.

    Regards

    Tim


  • edited January 2016
    Hi Tim,

    Yes a pass-thru function will be necessary in this case.

    I will add hyperlinks for images as a possible enhancement for a later
    release.

    Best Regards,

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

    Thanks. An image hyperlink would be good particularly for use with Facebook
    and Twitter links where the image is now ubiquitous.

    Tim


  • edited February 2016
    This is a follow up to my earlier posting.

    The OnDrawClickCommand event for the image did not work when the report was
    saved to pdf and this was an essential requirement. I overcame the problem
    by having an image with no event and then placing overtop a label sized the
    same as the image with a hyperlink but no caption. This worked brilliantly
    when saved as a pdf.

    Tim Murfitt




  • edited February 2016
    Hi Tim,

    Yes, OnDrawCommandClick events are not transferred to file exports.
    Great workaround!


    Best Regards,

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