How to launch an action when we click on an image?

Hi all,
How to launch a web link (or execute any command) when you click on an image?
There is no “Pressed” event associated with the DesktopImageViewer. How to do it?

You could use the MouseDown Event. (Better use the MouseUp Event, because users are more used to execute an action when the Mouse Button is released) :wink:

Or display the image in a canvas’ paint event, which gives you more control over the displayed image anyway

Thank you, I had tried with MouseUp without result. It works better with MouseDown event.

This event will not occur unless you return True in the MouseDown event. The return value is ignored.

So, you need to add both events and return True in the MouseDown event, if you want to use/handle the MouseUp event.

The MouseUp event has the advantage that the user can press the Button on your image and move the Mouse with the button still pressed down outside of the image, without triggering the MouseUp event. Thus “aborting” the action.