Combobox Popup unexpected behavior in AUv3

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).

(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).

(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?

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

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:

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.

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.

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.

Hi Reuk,

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

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:

  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

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.

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.