Async modifiers and Popup menu


#1

Hi,
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?

Thanks!


#2

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


#3

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.


#4

you can have a keyListener, set a flag when option is pressed and then reopen the menu directly via popupMenu.show(). 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()?
https://juce.com/doc/classMenuBarComponent#af24eead5eca57b4f29544c40449a4b8e