Popup Menu staying open

When I open a popup menu on mouseDown with a submenu, then the

popup menu stays open,  even when I click the mouse elsewhere (outside of the popup menu).

When I do the same, but without a submenu, then, as I would prefer/expect, the popup menu

disappears as I click outside of it. (I am working on MacOS 10.9).

Code below has the problem. Does not have the problem when "addSubmenu" line is commented out.

Any suggestions on fixing this are appreciated, thanks,


void MyWidget::mouseDown (const MouseEvent& e)
PopupMenu subMenu;
subMenu.addItem (1, "item 1");
subMenu.addItem (2, "item 2");
PopupMenu mainMenu;
mainMenu.addItem (3, "item 3");
mainMenu.addSubMenu ("other choices", subMenu);
const int result = m.show();

No.. I think you're misinterpreting something there, it definitely does work as far as I can tell. Must be something else going on in your other code (?)