【问题标题】:JUCE unable to insert button on audio pluginJUCE 无法在音频插件上插入按钮
【发布时间】:2017-06-04 15:03:16
【问题描述】:

我正在尝试在音频插件中添加一个按钮,但在测试时似乎无法显示它。

我正在使用插件主机进行测试,并查看 GUI。 pad1PluginEditor.h 中定义:

private:
    // This reference is provided as a quick way for your editor to
    // access the processor object that created it.
    CPAudioProcessor& processor;

    TextButton pad1;

我已将以下代码放在PluginEditor.cpp

CPAudioProcessorEditor::CPAudioProcessorEditor (CPAudioProcessor& p)
    : AudioProcessorEditor (&p), processor (p)
{
    pad1.setColour(TextButton::buttonColourId, Colours::lime);
    pad1.setButtonText("Press Me!");
    addAndMakeVisible(pad1);

    // Make sure that before the constructor has finished, you've set the
    // editor's size to whatever you need it to be.
    setSize (400, 300);
}

我按照本教程作为添加按钮的指南:https://www.juce.com/doc/tutorial_rectangle_advanced

我有什么遗漏吗?它看起来与指南中的代码相同。

【问题讨论】:

    标签: c++ juce


    【解决方案1】:

    问题是我忘记在覆盖的resized 方法中设置宽度/高度。

    void CPAudioProcessorEditor::resized()
    {
        // This is generally where you'll want to lay out the positions of any
        // subcomponents in your editor..
        pad1.setBounds(10, 10, 100, 100);
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-03
      • 1970-01-01
      相关资源
      最近更新 更多