That’s what I’m using… I just wondered if there is anything better in terms of layout.
Other thing: I’ve written an “addon” (well for now it’s not packed as addon), which allows to save presets (all gui parameters) and interpolate between them either sequentially or all at once. There is a time controller, so basically you can do some sort of slow morphing. Dunno if this might interest anyone, but I use it for visual installation to make it slowly morph between colors over time.
As @edapx mentions ofxGui is stable, and works well if you are not looking to get fancy. It can get a bit confusing for other users as it is so packed up, and there are some features missing that are useful (like a dropdown menu, for which I made an addon, ofxDropdown, that works with ofxGui.
ofParameters are used with but not exclusively with GUIs. The concept is simple, an ofParameter holds a value of certain type, the one you determine in between the < > when declaring it. Then whenever this value changes it notifies a change through an ofEvent. You can use this for a lot more things other than just a GUI. In the case of the GUI, this event signals that the GUI needs to redraw itself.
Using the ofParameter is the correct way of making buttons, though not toggles, with ofParameters and ofxGui.
I have posted a lot of times here in the forum about ofParameters and ofEvents, just search for these.
If you dont find these let me know and I can look for those. (to me ofEvents is one of the very powerful features of openFrameworks yet one that seems very elusive to a lot of users)
Thanks for your answer. It’s much more clear now especially regarding ofParameters. I now understand what it’s for and that actually it can be used in conjunction with other gui ofx* elements.Two more questions (the second one is most important) if I may?
why not toggles ? toggle seems to be working for me. ofParameter… passes information as it should, although shape is not very convenient to work with, just like ofParameter< void> button.
is there an existing mechanism to pass extra parameters to listener function ? When I addListener, the only parameter it takes is value. Sometimes I need to pass an extra value… Is there a way to do it ?
Hi, to make a toggle you use ofParameter<bool> as the toggle holds 2 different states. In terms of looks it is almost teh same as the button, but the checkbox stays either on or off, while the button, once clicked it will show wery fast like it got clicked but the checkbox is always off.
Can you give me an example of such case? In short, no.
As it is a callback function those parameters would need to be passed from whereever it gets called so it would be a bit cumbersome. What you can pass though is the sender object, which goes as a void pointer which you then need to cast to whatever you know that it is and from there extract data. In such case the callback signature would have an extra void * argument
Actually regarding toggles I was replying to your comment above “Using the ofParameter is the correct way of making buttons, though not toggles, with ofParameters and ofxGui.” Some misunderstanding ? )
Regarding listener and extra parameter, actually my example is a bit complicated. But I gave it another thought and actually it’s a fault of my class organization, so indeed it’s not necessary at all.