FR: PopupMenu::dismissMenu

I would like to propose a Feature Request:

Would it be possible to get a method PopupMenu::dismissMenu() ? That method would dismiss a single popup menu.
I know that there exists a method PopupMenu::dismissAllActiveMenus(). But that method closes all open popup menus. And I want to only close a very specific popup menu (if its open).

Alternatively, if that’s not possible:
Can we get a method PopupMenu::isShowing()? It would return true, if this specific popup menu is currently shown to the user.

Maybe you are wondering, why I want these methods.
My use case is that I am loading a large file (several Gigabytes) from disk. I do that in a background thread. But as soon as the item has loaded, I am resetting a certain portion of the UI. That portion contains a popup menu, which should close as well (if its open).
But I do not want to close all popup menus. Because a user could currently work on a different part of the UI, where the popup menus don’t need to be reset after the big file has finished loading. Those popups could continue to live.

Just curious… why do you need the menu to stay open at all? Why not close it as soon as the selection is made that triggers the download? Seems strange to keep a menu open, but allow using other parts of the plugin. I can’t recall ever seeing an app or plugin do that before.

Its like this:
Users can choose to load a large number of samples into the plugin. It can take up to one minute to load them.
But I don’t want to lock the UI for a whole minute. Therefore I am loading the samples in the background. So that the user can continue to interact with the UI, while its loading.

Native Instruments “Kontakt” does a similar thing when you load a library/instrument. Cause those instruments can take a while to load, they do it on a background thread. And the user can continue to use the UI and, for example, configure effects or similar.

Ok, I see that, but why does the menu have to remain open while the samples load? Usually, you pop up a menu only long enough to select an item from it, and get a return value from it when it closes (using showMenuAsync(), for example). Then you act on the return value.

I agree, I could probably implement a workaround for this.

BUT: in PopupMenu there already exists a function PopupMenu::dismissMenu(). Its private though and inside the MenuWindow helper class. Therefore I cannot call it.
If the JUCE team could add a public wrapper around it, that would be great. I am hoping that they can do that. :slight_smile: