Radio buttons and panel selections

Hi, I have a bit of a weird one here, and I wonder if anybody can help?:
I have a bunch of radio style buttons, that are saved through the usual way in the processor class, these button are used to select a certain panel on the display:

paraTree.createAndAddParameter(std::make_unique<AudioParameterFloat>("groupSelect_Osc", "Select Osc", norm, 1.0f));
paraTree.createAndAddParameter(std::make_unique<AudioParameterFloat>("groupSelect_Filter", "Select Filter", norm, 0.0f));

This attaches the parameter to the correct button and gets saved with all the other parameters.
I change panels by detecting if the user has hovered over the correct selector, ie the Oscilator tab. I do this with:

void Editor::mouseEnter(const MouseEvent& e)
	Component *comp = e.eventComponent;

	if (comp == nullptr)
		return;
	if (comp->getName() == "groupSelect_Filter")
	{
		SelectGroup("filterGroup");
		groupSelect_Filter.setToggleState(true, NotificationType::sendNotification);
	}
    else
etc...etc...

Unfortunately, nothing in the editor gets called when I re-load the parameters.
I’ve added a addParameterListener and addListener to the editor components but they are all added too late to get called with the load. I’m sure there’s a straight forward way to change the display depending on the parameter selected…

Do I actually have to read the parameter states when I add the UI buttons? It seems to go against the point of using listeners a bit.
edit I just noticed the correct radio button is ‘on’ as well but no listeners were called in the editor.

OK it seems I needed to add the listeners BEFORE the ButtonAttachment adds. :blush:

2 Likes