GUI confusion in OF

Hello,

Is it just me, or the whole GUI subject in OF is a bit mirky

There is ofxGUI, ofxGuiExtended, ofxUI, ofxIMGui and many others.

Then there is this concept of ofParameter() which is somewhat elusive to me.

I do manage to build GUI using ofxGui, but I’m not even sure that’s what I should be using.

I wanted to use ofxGuiExtended, but looks like there is no color picker (only RGB sliders?).

In ofxGui buttons look quite weird [ ] and the way they are created is somewhat strange as well “ofParameter< void>”. Am I doing this right ?

Anyway, I’m not complaining, but I’m just confused and can’t find any documentation…

Thanks
M

1 Like

Hi i know what you mean , i used ofUI but it got deprecated a long time ago and no one pick it up …
i jump to ofxImgui as it seems more complete for color picking and more much

If you do not need any visual customization, ofxGUI is what I would suggest, it is stable, you can see it in action in the the examples folder that comes with OF and it works.

1 Like

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.

Hi @SFR75
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.

Then ofxImGui works really well but it can get quite confusing, as it is packed with features and then a lot of people expands on top of it. I recommend you to try GitHub - moebiussurfing/ofxImGui: Please refer to the develop branch in https://github.com/jvcleave/ofxImGui. I'll keep this fork in sync until it's merged in master. as it has a lot of nice stuff in it a looks really well (not the default ImGui look at all).

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)

Hello,

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 ?

M

I’m not used to ofxGui too. after deprecation of ofxUI (2015 or 2016) I’ve decided to write one too, it fits my needs: GitHub - dimitre/ofxMicroUI: UI for OpenFrameworks

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.

Thanks
M

I see, I had a typo there, it should have said "Using the ofParameter<void> is the correct … "
good to know you figured it out

Defe
r
red