Modal behavior of titlebar during PopupMenu::show()

I am using a native title bar, latest Juce tip, on Windows 7 64-bit. When I show a popup menu in response to a right click, there is some odd behavior when operating the title bar.


  • User pops a Juce PopupMenu menu by right clicking in a ListBox
  • While the menu is up, and without first hovering over a menu item, press the close box of the window, opening the window menu with a left click (context menu in the top left corner of the window on the native title bar), or pop the titlebar menu (right click in the title bar area).


Menu is not dismissed. Close button does not function, context menu does not appear, and titlebar menu does not appear.

Note that if you hover over any PopupMenu item at least once before trying to operate the native title bar controls, then the popup menu is properly dismissed. However, the native title bar control does not operate from that click, an additional click is needed, after the popup is dismissed. One could argue this is also a defect, since standard Windows windows behave differently when the title bar controls are operated while a popup menu is active.

Ok, just sounds like it needs an extra check in juce_win32_Windowing.cpp,

[code] case WM_INITMENU:
if (sendInputAttemptWhenModalMessage())
return 0;

                if (! hasTitleBar())


Hmm…I added the function call as you suggested and that had no effect on the behavior described.

Ok, I just had a look, (and spent longer than I really should have done on something as minor as this…) For some strange reason, Windows just doesn’t send the WM_NCRBUTTONDOWN that it should do when you click in the title bar. It’s the sort of stupid win32 quirk where I could easily sit here for hours trying to figure out a workaround, and I don’t have time, so I’m going to have to leave it for now - sorry!

I’m not gonna lose sleep over this, I just thought I would report it. Some day it will get fixed by someone (well, I hope, hehe).