For a module similar to a mixer (see below) I try to
- define a group of buttons (one button per channel, row ‘E’ in the screenshot) that allows the user to select the channel for which parameters are shown/edited (in the gray box). Obviously only one channel can be in ‘edit mode’ at a time.
- define a widget (the gray box) that contains the parameters of a channel (instead of adding them to the module widget). The idea is to create one instance per channel and control visibility via the E buttons.
My attempts so far (like creating parameter controls in the constructor of my own widget) were not really elegant and/or resulted in crashes.
Is there a ‘best practice’ for what I am trying to do? Thanks!
EDIT
Looks like I found a solution to problem #2.
struct EditorWidget : OpaqueWidget
{
LabSeven_R128Widget *module;
void addParam(ParamWidget *pw)
{
module->params.push_back(pw);
this->addChild(pw);
}
EditorWidget(LabSeven_R128Widget *module)
{
this->module = module;
addParam(ParamWidget::create<LSR3EditSwitch>(Vec(15,25), module->module, LabSeven_R128::MAP0101 , 0.0f, 1.0f, 1.0f));
}
};