Clicking a button twice to show a menu

If I click on a button to show a menu and then click that button again, it hides the menu.

If I click on a different button, it hides the menu and shows the second buttons menu. How the heck does this work?

I want to first behaviour to work on my custom component so I can click to dismiss menu. I’m sure I’ve asked this before but I can’t find the thread.

Ok, I figured it out. If a menu is open and you click on the target Component of the menu, the menu eats the mouseDown() so that my Component doesn’t get it. My component will still get the mouseUp.

In my mouseUp, I was testing if MouseEvent::mouseWasClicked() was true and if so, then I was showing my menu.

Should mouseWasClicked() return true if there was no mouseDown? I guess the mouse was clicked, but just not on my component. It would be nice if there was a mouseWasClicked (Component*) that would return if the mouse was clicked on the specified component.