ofParameter groups for buttons/typing/colorpickers

Hi, I’ve followed a few tutorials and know how to use the GUI to make buttons, type inputs and color pickers but now that I put all these in classes I found it easier to use the ofParameter class and just add param groups for each class to a main GUI.

The problem with this is that using ofParameter I only understand how to create simple sliders and such like float,int,boolean and vec3. How can I add buttons/type inputs/ and color pickers to param groups ?


Hi @kaspar.wtf,

You can do :

ofxPanel gui;
ofParameter < ofColor > myColor;
ofParameter < bool > myButton;
ofParameter < string > myString;

Which gets instantiated like so :

gui.add(myString.set("my string"));



1 Like

Thanks I can’t believe it’s this simple !
there’s two small things I’d like to ask concerning this, it seems like the types are attached to the inputs.

  1. if i wanted to type an int or a float inside of an int or float slider, how would I proceed ?
  2. also the bool only creates a checkbox, not a button, should I make it work like a button via script or am i missing something ?

Thanks a lot for the help !

It’s also relatively simple :slight_smile: :

  1. right click on the float slider, and enter the value you want to use. You can use an int in place of a float, but not the reverse of course…

  2. I think you might mean toggle? button turns on or off when pressing on it, toggle sends a On message then turns itself Off on the next frame. For that, I personnaly check its value in the ofApp::update :

cout << "ok we got an ON message" << endl;
// do something with it 
myButton = false;


1 Like

gosh that’s so simple, thank you so much

IT is actually much simpler than that.
use ofParameter<void> which will give you a button, not a toggle. If you add a listener to it then it will get called each time the button is pressed. :slight_smile: