0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

JUCE: AUv3でComboBoxがクリックできない場合の対処法

Posted at

JUCEで作ったAUv3プラグインのUIでComboBoxがクリックできない場合の対処法。ってか、これないとまったくクリックできなくない?

ソースはここ。2020年からずっと続いている問題というか仕様ってことになってるのか?
https://forum.juce.com/t/bug-popup-menu-background-and-logic-silicon/43243/10

LookAndFeelgetParentComponentForMenuOptions()をオーバーライドして、Mac/iOSのAUv3の時のみComboBoxの親コンポーネントを返す。ComboBoxをクリックした時に出るポップアップメニューのTarget ComponentはComboBoxなので、そのparentを返せばいい。それ以外の場合はLookAndFeelのデフォルト動作になるように。

//  Workaround to make ComboBox clickable for AUv3 on Mac/iOS
juce::Component* getParentComponentForMenuOptions (const juce::PopupMenu::Options& options) override
{
#if JUCE_MAC || JUCE_IOS
    if (juce::PluginHostType::getPluginLoadedAs() == juce::AudioProcessor::wrapperType_AudioUnitv3)
    {
        if (options.getParentComponent() == nullptr && options.getTargetComponent() != nullptr)
            return options.getTargetComponent()->getParentComponent();
    }
#endif
    
    return juce::LookAndFeel_V4::getParentComponentForMenuOptions (options);
}

このLookAndFeelをデフォルトにすればOK。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?