About right-clicked popup menu on ComboBox


I have definition the mouse right-click pop-up menu or showMessageBox, but when I right-click and mouse cursor on any ComboBox, ComboBox’s menu also appears, how does not appear?



Sorry, I’m struggling to understand your english a bit there… Can you try to explain again?


such as: component A consists of many sub-components, ComboBox, Button, Label, etc. I want: after mouse right-click on Component A, display a pop-up menu, or display a pop-up message window.

Everything was nice. I used an invisible component as a container to display the context menu when mouse right-clicked. rewrite mouseDown().

But, when the position has mouse right-clicked that on any ComboBox, ComboBox’s list menu and pop-up contex menu displayed at the same time.

so, two menu let me puzzled.

BTW,I found JUCE‘s mouse left button and right button to do the same thing (click button etc. ), it makes me surprising also…


Do you mean that you’ve got your own component in front of the ComboBox (i.e. covering it), but the combobox is still receiving mouse-clicks through your component?


My component only handle mouse right-click,to display context menu (pop-up menu). This component is invisible, if not, other component (button, combobox etc.) can’t operate.

but, when right-click on combobox, the combobox’s list menu and invisible component’s context menu display at same time, so, two menu on screen…This is obviously not what I want.

My English so poor…I was so depressed… :cry:








Solved. I had to write a derived class, only for cancel the ComboBox’s pop-up menu when right-clicked on this.

my code:

class MyComboBox:public ComboBox { public: void mouseDown(const MouseEvent& e) { if (e.mods.isLeftButtonDown()) showPopup(); } };


I don‘t understand, why the mouse left click and right click to do the same thing on JUCE’s buttons, comboboxes, etc. ? By default, the right mouse button should not operate them.


By this, I learned some JUCE knowledge, although very difficult to explore, but very happy.

Thanks Jules.


Why not? There’s no reason why it shouldn’t do the same thing. I think some people make buttons perform different tasks depending on the button that clicked it. (That’s probably not something I’d ever do myself, but there may be contexts where it’d be useful).

It looks like the combo box actually does behave a little strangely when you right-click it though - I guess I never tried doing that before. I’ll tidy that up, so it just ignores right-clicks.


Yes. This operation is indeed very flexible.

However, a region has a right click pop-up menu, the region also contains a combo box, the user probably right-click that the position just on combobox…then, two menu on screen (combobox’s menu and regional right-click menu) , this will make them confused.