Just create a Plug-in with PJ, and add a ComboBox and a LookAndFeel:
/*
==============================================================================
This file was auto-generated!
It contains the basic framework code for a JUCE plugin editor.
==============================================================================
*/
#pragma once
#include "../JuceLibraryCode/JuceHeader.h"
#include "PluginProcessor.h"
//==============================================================================
/**
*/
class Test5AudioProcessorEditor : public AudioProcessorEditor
{
public:
Test5AudioProcessorEditor (Test5AudioProcessor&);
~Test5AudioProcessorEditor();
//==============================================================================
void paint (Graphics&) override;
void resized() override;
private:
// This reference is provided as a quick way for your editor to
// access the processor object that created it.
Test5AudioProcessor& processor;
ComboBox m_Combo;
LookAndFeel_V4 m_Look;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Test5AudioProcessorEditor)
};
and
/*
==============================================================================
This file was auto-generated!
It contains the basic framework code for a JUCE plugin editor.
==============================================================================
*/
#include "PluginProcessor.h"
#include "PluginEditor.h"
//==============================================================================
Test5AudioProcessorEditor::Test5AudioProcessorEditor (Test5AudioProcessor& p)
: AudioProcessorEditor (&p), processor (p)
{
// 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);
m_Combo.setBounds(10, 10, 100, 30);
addAndMakeVisible (m_Combo);
m_Combo.setLookAndFeel (&m_Look);
m_Combo.addItem("One", 1);
m_Combo.addItem("Two", 2);
m_Combo.addItem("Three", 3);
}
Test5AudioProcessorEditor::~Test5AudioProcessorEditor()
{
m_Combo.setLookAndFeel (nullptr);
}
//==============================================================================
void Test5AudioProcessorEditor::paint (Graphics& g)
{
// (Our component is opaque, so we must completely fill the background with a solid colour)
g.fillAll (getLookAndFeel().findColour (ResizableWindow::backgroundColourId));
g.setColour (Colours::white);
g.setFont (15.0f);
g.drawFittedText ("Hello World!", getLocalBounds(), Justification::centred, 1);
}
void Test5AudioProcessorEditor::resized()
{
// This is generally where you'll want to lay out the positions of any
// subcomponents in your editor..
}
If you change the variable order you get rid of the assert as expected… but setting the L&F to nullptr doesn’t (which I thought odd).
To test, build as Debug, run and open and close the ComboBox PopupMenu without selecting anything a few times… then quit.
Cheers,
Rail
