Async modifiers and Popup menu

Only suggested topic is this: Async PopupMenu FR

So here is my question.
On macOS for example I can get additional options using the Opt/Alt modifier. while menu is opened.

  1. Is there a singleton / global object I can query for current modifier keys (while my code is running)?
    Update: there’s ModifierKeys::getCurrentModifiers()

  2. Is there a way to invalidate a Submenu / Popup Menu?


Can you expand on what you mean by “to invalidate” a menu?
Can you just menu.setEnabled(false)?

No. the specific case is let’s say I have a menu:

      Opt A
      Opt B
      Opt C 

I’d like upon click the modifier keys to have the PopUp “invalidate” and show:

      Opt A
      Opt B
      Opt C 
      Opt D 
      Opt E 

I can close/reopen it but that’s not elegant and can make more problems than being helpful.

you can have a keyListener, set a flag when option is pressed and then reopen the menu directly via your MenuBarComponent doesn’t have to be the only one who shows the popupMenu returned from MenuBarModel::getMenuForIndex()

if the menu is already open, what happens if you call menuBarComponent.showMenu()?