I was having a problem with a combo box with a large menu (17 entries). If the window was too close to the bottom of the screen, the pop-up menu does correctly appear above the combo box, but would vanish as soon as I released the mouse.
If the pop-up menu was below the combo box, then it would remain after I did the first mouse-up and would only vanish after clicking an entry in the pop-up menu.
Looking at ComboBox::mouseUp, I found an if statement that decides whether or not to dispatch the mouse-up to the pop-up menu. So I changed this:
if (activePopup != 0)
{
activePopup->handleMouseUp (e);
}
to this:
if ((activePopup != 0) && activePopup->contains (e.getScreenX() - activePopup->getScreenX(),
e.getScreenY() - activePopup->getScreenY()))
{
activePopup->handleMouseUp (e);
}
That seems to have done the trick.
There might be a cleaner way to do this, but this is fine for now.
Strangely, this problem doesn’t occur with the combo box in the JUCE demo.
Matt