Stop ofxPanel calling listener on mouse release?

I’ve set up an ofxPanel to control my app (a GPU-side fractal generator), added some float parameters, and registered listeners as usual. While debugging, I noticed that the sliders are calling the listener on mouse release as well as mouse press. Since the listener marks my mesh as dirty and dispatches a whole string of compute shaders to rebuild it, I’d like to avoid the extra calls if i can. Is there any way to deactivate the call on mouse release? I don’t mind subclassing and overriding methods if I have to, but I’m pretty clueless about the events side of things at the moment and documentation is fairly sparse so not sure how to go about it.

no but it makes sense, hte value will be the same as the last move so it probably doesn’t make sense to call on release. can you open an issue in github?

what you can do right now is don’t throw events until release so you don’t get a ton of events and only get the final value when you release the mouse which is much lighter. just call setUpdateOnReleaseOnly(true) on any slider

OK done, issue #4939. Thanks for the tip Arturo, that will work for now. I’m adding a few ofParameter<float> to an ofParameterGroup then adding that to an ofxPanel. So I should set a name for each ofParameter then do myPanel.getFloatSlider(name).setUpdateOnReleaseOnly(true) , right?

1 Like

yeah that’s it

I am trying to use this feature but is not working. I am not sure if we have to call this method before or after adding the listener…

gui_TextPlayer.setup("TEXT PLAYER");
gui_TextPlayer.add(params_TextPlayer);

//set slider to trig on release
gui_TextPlayer.getIntSlider("SLIDE Duration (Relative)").setUpdateOnReleaseOnly(true);
gui_TextPlayer.getIntSlider("GLOBAL DURATION (ms)").setUpdateOnReleaseOnly(true);
gui_TextPlayer.getFloatSlider("GLOBAL Time Scale").setUpdateOnReleaseOnly(true);
gui_TextPlayer.getFloatSlider("GLOBAL BPM").setUpdateOnReleaseOnly(true);

//gui_TextPlayer.setPosition(screenW - 205, -20);
ofAddListener(params_TextPlayer.parameterChangedE(), this, &ofxFontAnimator::Changed_params_TextPlayer);

I am on macOS / OF GitHub

any help about this?

Maybe it’s the way how I make the listeners?
In another post (ofParameter listeners) I see you where using:

ofEventListener updateListener;

updateListener = padding.newListener(&{this->rebuildGrid();});