# Combobox Popup unexpected behavior in AUv3

**URL:** <https://forum.juce.com/t/combobox-popup-unexpected-behavior-in-auv3/59363>\
**Category:** MacOSX and iOS\
**Created:** [January 3, 2024, 5:21pm UTC](https://forum.juce.com/t/combobox-popup-unexpected-behavior-in-auv3/59363 "2024-01-03T17:21:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![aleFX](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@aleFX](https://forum.juce.com/u/aleFX)\
**Post date:** [January 3, 2024, 5:21pm UTC](https://forum.juce.com/t/combobox-popup-unexpected-behavior-in-auv3/59363/1 "2024-01-03T17:21:12Z")

</div>

I’m currently porting my plugin to iPadOS (both standalone and AUv3) and everything works as expected except from the Popup menus of my Comboboxes.

First of all, I’ve got a couple of comboboxes inside some components that are AudioProcessorEditor’s children.  
The structure:

- AudioProcessorEditor
  - customComponent1
    - combobox1

  - customComponent2
    - combobox2

In My look n feel class I’ve overridden the method “getParentComponentForMenuOptions” in order to return a Component that I set as I wish.

**Standalone app:**  
I pass my AudioProcessorEditor to the LnF class using getParentComponent() in my custom component and everything works as expected: the popup related to the combobox is shown correctly and it is actually able to expand over the boundaries of its parent component (and that’s right since I’ve passed the whole ProcessorEditor and not a “this” reference).

 ![IMG_0006](https://us1.discourse-cdn.com/flex026/uploads/juce/original/3X/d/4/d4c9efde1690ead541489e9704c914ac4dc05943.png)

(in red the bounds of the component that own the combobox)

**AUv3:**  
If I do the same thing, nothing happens: **the combobox popupmenu does not show up**. If I pass “this” the popupmenu shows up, but it is restricted inside the parent component, and therefore is both ugly and difficult to use (it cannot go over the boundaries of “customComponent1” and so on for the others).

 ![IMG_0007](https://us1.discourse-cdn.com/flex026/uploads/juce/original/3X/b/b/bbfd60619b33e5299d488ea73b08314e0022e8d2.png)

(This is in Garageband for iPadOS)

Basically, the expected behavior can be seen only in the standalone, while in the AUv3 I’m forced inside the bounds of the parent component, and if I try to use the whole Editor as in the Standalone, the menu does not show up when touching the combobox.

Is there something that I’m doing in the wrong way? How can I solve this issue and show a proper popup menu also in the AUv3 versions?

---

<div class="post-metadata">

**Author:** ![aleFX](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@aleFX](https://forum.juce.com/u/aleFX)\
**Post date:** [January 5, 2024, 12:31pm UTC](https://forum.juce.com/t/combobox-popup-unexpected-behavior-in-auv3/59363/2 "2024-01-05T12:31:56Z")

</div>

Small bump up: is that an iOS/AUv3 limitation or I’m doing something in the wrong way?

---

<div class="post-metadata">

**Author:** ![aleFX](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@aleFX](https://forum.juce.com/u/aleFX)\
**Post date:** [January 11, 2024, 7:20am UTC](https://forum.juce.com/t/combobox-popup-unexpected-behavior-in-auv3/59363/3 "2024-01-11T07:20:02Z")

</div>

Update: after a long investigation, I can confirm that the behavior is not aligned with the expectations. In a mobile DAW (so AUv3 format), the plugin cannot create new windows, and that’s the reason why JUCE added the “getParentComponentForMenuOptions” function in LnF:

> [@PopupMenu not showing on AUv3 plugin](https://forum.juce.com/t/popupmenu-not-showing-on-auv3-plugin/17763):
>
> Here’s a minimal example project: [Click here](https://dl.dropboxusercontent.com/u/6617733/371EF490-5E21-43BE-89EE-AC63A452003A/PopupMenuTest.zip) It’s basically the Projucer Audio Plugin template, really the only changes are in PluginEditor.h/.cpp. When I run it as an AUv3 app extension in iOS GarageBand, the PopupMenu doesn’t show. It shows correctly on the AUv3 standalone.

As explained before, if I set my custom component as the popup menu parent, the popup is actually shown, but it’s difficult to use and definitely ugly. On the other hand, setting the whole audioProcessorEditor as the parent is not working, and the popup does not show up.

This is in contrast with the documentation and what can be read in the blog post above, by setting the AudioProcessorEditor as a parent the popup menu should be visibile, and also not restricted in its parent component bounds.

Am I missing something? Is there something I can do? This is the only issue that is blocking our iPad public release, so it’s really important.

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [January 16, 2024, 12:57pm UTC](https://forum.juce.com/t/combobox-popup-unexpected-behavior-in-auv3/59363/4 "2024-01-16T12:57:45Z")

</div>

I gave this a test in the AudioPluginDemo by adding a ComboBox and setting a custom default LnF to configure the parent component for popup menus.

`getParentComponentForMenuOptions` looks like this:

```
Component* getParentComponentForMenuOptions (const PopupMenu::Options& options) override
{
    if (auto* target = options.getTopLevelTargetComponent())
        return target->findParentComponentOfClass<AudioProcessorEditor>();

    return nullptr;
}

```

When I load the plugin in GarageBand or Loopy Pro on iPadOS 17.2, the popup menu appears as expected after tapping on the combo box.

> [@aleFX](#):
>
> In My look n feel class I’ve overridden the method “getParentComponentForMenuOptions” in order to return a Component that I set as I wish.  
> …  
> I pass my AudioProcessorEditor to the LnF class using getParentComponent() in my custom component

Given that this appears to work in a simple test case, I suspect that something’s going wrong when configuring the custom LnF. Maybe the returned editor component is null or invalid, or maybe the LnF isn’t being applied at all.

If you’ve checked your LnF and still can’t resolve the issue, it would be helpful if you could provide a minimal code example (e.g. a modified version of one of the JUCE demos) for us to debug.

---

<div class="post-metadata">

**Author:** ![aleFX](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@aleFX](https://forum.juce.com/u/aleFX)\
**Post date:** [January 17, 2024, 8:45pm UTC](https://forum.juce.com/t/combobox-popup-unexpected-behavior-in-auv3/59363/5 "2024-01-17T20:45:35Z")

</div>

Hi Reuk,

Thank you so much, it works! The method signature is slightly different:

```auto
Component* getParentComponentForMenuOptions (const PopupMenu::Options& options) override
{
    if (auto* target = options.getTargetComponent())
        return target->findParentComponentOfClass<AudioProcessorEditor>();

    return nullptr;
}

```

Now my comboboxes show their menu without being restricted in their parent component. Unfortunately there is still an issue: submenus do not show up.

I’ve set the same LnF also for the submenus, which are PopupMenus added with this syntax:

```auto
  PopupMenu* m = myComboBox.getRootMenu();
  
  m->addSubMenu("sub_menu_name_1", myPopUpMenu1);
  m->addSubMenu("sub_menu_name_2", myPopUpMenu2);

```

In the Standalone app everything is still working as expected, and the “getParentComponentForMenuOptions” implementation is of course the same

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [January 17, 2024, 8:51pm UTC](https://forum.juce.com/t/combobox-popup-unexpected-behavior-in-auv3/59363/6 "2024-01-17T20:51:39Z")

</div>

`getTopLevelTargetComponent` was added quite recently on develop, and should fix the issue for submenus. I recommend updating to the newest develop version of JUCE and testing with that change. If it’s still broken after that, please let us know.

---

<div class="post-metadata">

**Author:** ![aleFX](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@aleFX](https://forum.juce.com/u/aleFX)\
**Post date:** [January 17, 2024, 9:44pm UTC](https://forum.juce.com/t/combobox-popup-unexpected-behavior-in-auv3/59363/7 "2024-01-17T21:44:34Z")

</div>

It works! Thank you, this fix will be part of JUCE 7.1.0? I would like to avoid to use a develop branch for a commercial product.
