Detecting right click in ListBox::backgroundClicked()


#1

Hi.

The function does not have a MouseEvent parameter so I tried:

 ModifierKeys::getCurrentModifiers().isRightButtonDown() 

and

Desktop::getInstance().getMainMouseSource().getCurrentModifiers().isRightButtonDown()

All to no avail, how do I find whether it was a right click of now?
Thanks


#2

That’s probably because the event is triggered when the mouse-up happens, so the right button is no longer down.

I don’t really want to get into a feature-creep situation where I add more and more callbacks: if I add a rightButtonClicked method someone will then ask for a mouseMoved, mouseDragged, etc etc. Maybe just add your own mouselistener to the component and intercept the events?


#3

ok, thanks.