Hello, I put a collection of buttons in a deque and I trying to use the same .addlistener for each button where the .addlistener would just return the name of the button. My code for calling the listener function is,
Looking at other posts I feel like this should work, and I have no idea what I am doing wrong, but I keep getting this error,
‘ofAddListener’: none of the 5 overloads could convert all the argument types.
You shouldn’t be creating a parameter of a button, the button itself has an event that can be listened the way @hamoid explains
Also if you want to use ofParameters instead of the gui elements directly, if you are using the nightly builds or 0.10 you can create a ofParameter<void> that when added to a panel, directly or through a parameter group, will create a button. Then you can use the parameter addListener or newListener functions to listen to that button event
“hey, that should work too if there’s multiple buttons inside a group?”
so I’m trying to do exactly this I think. I have a set of toggles inside a group that sits in a gui container. Exclusive toggle= true and I want to add a listener for whenever a different toggle is selected.
However, the group gui doesn’t have a listener class I guess? What would be the correct syntax for this? All of the examples I have seen assume you have e.g. a button inside a container only, not within a group in that container.
Here you have another snippet, using modern lambdas, ready to copy-paste and test. (ofApp .h/.cpp)
The group 2 has the exclusive bool/toggles implemented, as you asked for.