[6.1] issue with 'show': is not a member of 'juce::PopupMenu'?


I updated to the latest 6.1 and have the following error :
‘show’: is not a member of ‘juce::PopupMenu’

same with showAt.
However, when looking at the documentation, the show() method should still be available.
Am I missing something?


From breaking-changes.txt :

The breaking changes text unfortunately doesn’t mention it yet but for example the PopupMenu show and showAt methods will not be available with the JUCE_MODAL_LOOPS_PERMITTED set to 0.

A quick workaround is to define 1 for JUCE_MODAL_LOOPS_PERMITTED for the project build. A proper fix will require to make the use of the PopupMenus and similar classes asynchronous. (The showMenuAsync method can be used for PopupMenu, but using that is not completely straightforward.)


Thanks but where is this define in the projucer? I can’t find it :frowning:

You can put JUCE_MODAL_LOOPS_PERMITTED=1 in the Preprocessor Definitions field.


I see the hack fix, however I think this change is quite sad, because show and showAt, was a simple way to show a popup menu and a returned menu choice. Why was this done?

It was apparently changed because the Android OS simply does not have any way to do modal loops in the GUI thread.

Modal loops can also be problematic in audio plugins on the other platforms, so I guess the Juce team finally decided to make the default behavior that the modal loops are not allowed.

We also noticed some issues : the mouseExit event is ignored if another component enters the modal state.

An example : if we have a button with hover effect(let’s say the button becomes red) and triggers a modal window (like file chooser), when the modal window is closed, the button stays in hover state (red) because the mouseExit of the button is not called.
Another issue is that while the modal window is displayed, events on the button are ignored (normal) except the mouse cursor of the button that changes and should not.

bug (1)