"one of many" choice button group + grouping parameters in widget


(Highcarbschwabe) #1

For a module similar to a mixer (see below) I try to

  1. 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.
  2. 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));
	}
};

#2

Don’t know how much help this is but problem one is called a Radio button.


(Highcarbschwabe) #3

I know radio buttons from VCL, Qt etc. but I have not seen them in Rack (so far). I guess I will implement this myself.


(Highcarbschwabe) #4

There will be radio buttons in Rack v. 1

https://vcvrack.com/docs/structrack_1_1ui_1_1RadioButton.html

So it is probably not a good idea to have a redundant implementation. I’ll use a fader and replace it later by a radio button.