[Solved] - Dynamic OfParameter<> settings


Fairly new to OF and I was wondering if it was possible to have Dynamic OfParameters<> settings.

In my code I have a ofPlanePrimitive and I want a slider to go from both edges of it’s Width,
If I change my plane width with code elsewhere my slider_x range will remain with the initial value it was given.

void ofApp::setup(){

	plane.set(75, 30);


	slider_x.set("Positionx", 0, plane.getWidth() / -2, plane.getWidth() / 2);


I understand it’s probably due to my slider_x.set() code being in the Setup() func of my app but I’m unsure where else I could put them.

Cheers !

Hi @Frank1 , yeah you can use ofParameter::setMin() and ofParameter::setMax() to change the min and max values for an ofParameter. You can also get the min and max values with ofParameter::getMin() and ofParameter::getMax().

Hi @TimChi ,

This works perfectly, I saw those two functions in the documentation by I thought they were doing something way different than that and didn’t bother trying …

Thanks for the quick reply, have a nice day !

Hey glad to hear it and the documentation can be sparse sometimes so don’t be afraid to ask in the forum or search the forum posts if you have any questions. Have fun!

1 Like