ofxGui event when parameters have been changed

Is there an event for ofxGui that indicates one of the parameters in an ofxPanel instance has been changed?

1 Like

every parameter has an event to notify it has changed so you can suscribe to an individual parameter event like:

param.addListener(this, &ofApp::paramChanged);

or to the parameter group which will also send you the parameter that changed like:


in the second case the event will send the parameter that changed as an ofAbstractParameter from which you can query it’s name…

1 Like

Ah! I see. Thanks.
I only have to know that the parameters have changed instead of the parameter changed, so there’s no problem there.

Sorry to revive this old topic, but I can’t seem to find the way to add a listener to a parameter group.

I’ve tried Arturo’s suggestion:

parameters.addListener(this, &ofApp::paramsChanged);

but it didn’t compile (got error: no member named addListener…), so I tried this:

ofAddListener(parameters.parameterChangedE, this, &ofApp::paramsChanged);

this compiled, but the listener is not getting called.

Am I doing something wrong?

1 Like

there’s a bug where a parameter will only report it’s changed to 1 group so if for example you have a group of parameters and later put that same parameters into a gui the original group won’t get the events. maybe that’s the problem you are seeing?

Some time ago, I also tried to add an event listener on a parameter group from a gui. I don’t exactly remember in which order I was adding this group to the gui though.

What I am sure is that I tried many different ways without any success so ended up adding an event listener on each parameter of the gui.

@arturo you are right, I was adding that group to an ofxPanel. If I don’t add the group to the gui the listener gets called when I change any parameter. The only workaround seems to be adding a listener to each parameter of the group as @Meach suggested.

If anyone is interested, there’s already an open issue on github, so hopefully there will be a fix to this soon.


Thanks for your help!

Hi arturo,

I dont know if the bug you are talking about has been fixed, but it is happening to me.

When copying the ofParameterGroup, the original group does not get the events.

This seems to be because the copy constructor is not defined, and the ofEvent is being copied, so the original group has a different event than the copy. I understand this is not a desired behaviour, so defining a copy constrcutor where the event is referenced would be the solution, right?

can you post an example of the bug?

False alarm, it works as it should! :slight_smile: