Hi all
I’m trying to use a AudioParameterChoice in combination with a ComboBox, which seems to be a pretty logical combination.
They both get their choices/items from an external file (Globals.h)
To connect the two I’d like to use a comboBoxAttachment.
In the following example, there won’t be an initial value in the comboBox. This is because the comboBoxAttachment sends an initial update, before the ComboBox has its items.
class A
{
public:
A () : comboBoxAttachment(correspondingParameter, comboBox),
{
addAndMakeVisible(comboBox);
comboBox.addItemList(Globals::itemsList, 1);
}
private:
ComboBox comboBox;
}
The solution I came up with works, but it isn’t very elegant.
class A
{
public:
A () : comboBox(),
dummy(setItems()),
comboBoxAttachment(correspondingParameter, comboBox)
{
addAndMakeVisible(comboBox);
}
int setItems()
{
comboBox.addItemList(Globals::itemsList, 1);
return 0;
}
private:
int dummy;
ComboBox comboBox;
}
This way the comboBox will be initialised and have its items before the attachment sends the initial update.
It seems quite quirky though. Am I doing something completely wrong?
Thanks R