# Async modifiers and Popup menu

**URL:** <https://forum.juce.com/t/async-modifiers-and-popup-menu/26660>\
**Category:** General JUCE discussion\
**Created:** [March 6, 2018, 11:50am UTC](https://forum.juce.com/t/async-modifiers-and-popup-menu/26660 "2018-03-06T11:50:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ttg](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ttg/32/14456_2.png) [@ttg](https://forum.juce.com/u/ttg)\
**Post date:** [March 6, 2018, 11:50am UTC](https://forum.juce.com/t/async-modifiers-and-popup-menu/26660/1 "2018-03-06T11:50:44Z")

</div>

Hi,  
Only suggested topic is this: [Async PopupMenu FR](https://forum.juce.com/t/async-popupmenu-fr/19107)

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!

---

<div class="post-metadata">

**Author:** ![ImJimmi](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/imjimmi/32/10843_2.png) [@ImJimmi](https://forum.juce.com/u/ImJimmi)\
**Post date:** [March 6, 2018, 3:28pm UTC](https://forum.juce.com/t/async-modifiers-and-popup-menu/26660/2 "2018-03-06T15:28:56Z")

</div>

> [@ttg](#):
>
> 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)`?

---

<div class="post-metadata">

**Author:** ![ttg](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ttg/32/14456_2.png) [@ttg](https://forum.juce.com/u/ttg)\
**Post date:** [March 6, 2018, 3:41pm UTC](https://forum.juce.com/t/async-modifiers-and-popup-menu/26660/3 "2018-03-06T15:41:39Z")

</div>

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

```auto
      Opt A
      Opt B
      Opt C 

```

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

```auto
      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.

---

<div class="post-metadata">

**Author:** ![matkatmusic](https://avatars.discourse-cdn.com/v4/letter/m/dfb087/32.png) [@matkatmusic](https://forum.juce.com/u/matkatmusic)\
**Post date:** [March 8, 2018, 10:03am UTC](https://forum.juce.com/t/async-modifiers-and-popup-menu/26660/4 "2018-03-08T10:03:34Z")

</div>

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](https://juce.com/doc/classMenuBarComponent#af24eead5eca57b4f29544c40449a4b8e)
