Right-click events in buttons

Sorry this is a very beginner question.

I have some buttons accepting on_press and sending messages.
However, how do I now allow it to differentiate left and right clicks? Do I have to use subscriptions, or is there an easier way?

Button doesn’t support right click events. Wrap your button with a mouse_area widget and use with on_right_press instead.

The only available example with mouse_area is this, which uses on_press but gives you some idea of how to use it: iced/examples/modal/src/main.rs at master · iced-rs/iced · GitHub

2 Likes