Mouse clicks different between Mac and Windows on Popup Menu

I’m sorry if this has been covered before, but I couldn’t find it in a search. I’m using the non-modules “bleeding edge” of JUCE (1.54.27) and am seeing a subtle, but sometimes problematic, behavior on Mac with left mouse clicks and popup menus.

An easy way to see the issue is to modify the Table demo in JUCE demo. Put a text button just above the table. When the button is clicked, create a popup menu that is long enough to overlap the table header (you can just use the popup menu example from the Widgets demo). Under Windows, the popup menu works as expected. It displays, you click, and it dismisses. Under Mac, the menu still behaves normally, but the Table header bar will respond to the left mouse click used to select a menu item over it.

This is problematic in that you have to be careful about popup menus appearing over controls (or at least certain controls, in the case above, the table header will respond to left mouse clicks in the menu, but the table will not). Again, I’m sorry if this has been covered before. I can post a tweaked Table demo .cpp/.h that demonstrates the problem if nec.

Thanks in advance for any feedback/advice.

That sounds very odd… I use a mac all the time and have never seen anything like that…

A code snippet that I could use to reproduce it would be great, just to make sure I’m doing the same thing as you.

Hi,

See the enclosed. I simply modified TableView.cpp from JUCEDemo (changes marked with !!!). The image shows a mouse down, notice that the table column header under the menu reacts to the mouse down even though the menu is over it. In this case, the bug is just cosmetic (since I throw up a message box in response to the menu, the highlight will get stuck), but I’ve had other controls act strangely.

Built with XCode 4.1, no settings changed.

Let me know if there is any other info I can provide.

Thanks for the quick reply.

Thanks - it’s just a really subtle problem with the table header component, which is sometimes incorrectly thinking that the mouse has entered it.

I’ll tidy it up, but it’s nothing serious, and certainly won’t affect any other components.

FWIW, you don’t need any altered code at all, just click on a regular menu over the table header in the unaltered JUCEDemo. The only reason I modified it is that the view generally changes when you click a normal menu.

It is interesting to me that the behavior is different in Windows and Mac. Also, I see some similar oddities with popup menus over some other controls (and, again, only on Mac).

Thanks again for the quick reply.

It wasn’t anything platform-specific, any differences must just have been because of subtle differences in the order of mouse/focus events.

Like I said, it was a pretty trivial problem, specific to the table header comp, and I’ve checked in a fix already.

FWIW, by “interesting” I meant “interesting, if the bug is in the control, then there must be something subtle about mouse message dispatching or something between platforms…” not ‘are you SURE that it is a bug in the control…’

I’ll be interested in looking at the fix. Normally, this is the sort of thing where I’d set a break point deep down and walk my way through to get more familiar with the environment, but I just haven’t had time.

I did see similar issues with some other controls, I’ll go back and create some simple examples for each of them and pass them on.

Thanks (yet again) for the speedy response.

Ok, thanks!

NP.

I see the fix on your ‘Modules’ branch, seems pretty clear. The component must not get the mouse messages when it is behind a popup menu on Windows. Something I’ll enjoy spelunking sometime.