Hey @arturo realy nice tip!
I was about to suggest to use an ofParameterGroup, add the ofParameters to it and then add a listener to the group.
in the class definition ( .h file) I added:
ofxPanel gui;
ofParameter<float> floatParam;
ofParameter<int> intParam;
ofParameterGroup group;
void listenerFunction(ofAbstractParameter& e);
And In setup in the .cpp:
gui.setup();
gui.add(floatParam.set("float param", 0,0,1));
gui.add(intParam.set("int param", 0,0,255));
group.setName("group");
group.add(floatParam);
group.add(intParam);
ofAddListener(group.parameterChangedE(), this, &ofApp::listenerFunction);
//--------------------------------------------------------------
void ofApp::listenerFunction(ofAbstractParameter& e){
//do something
}
Although, when using the lambdas. do I need to remove the listener somehow (like when you call ofRemoveListener(…)? Or does it get removed automatically when the ofEventListener object gets destroyed?
Thanks!