Gui slider not working when just a group is drawn


#1

Hi, I have a GUI composed by several ofParameterGroup. Each of them containing a bunch of ofParameter<float>.
When I draw just one group, like:

gui.getGroup("Animator").draw();

The slider on the float values are broken. It is possible to change the values clicking on the slider, but not by dragging the mouse from left to right or viceversa.

If I draw the gui like:

gui.draw();

Everything works as expected.


#2

The same happens with an ofParameter<ofColor>


#3

you are not supposed to do that :slight_smile:
if you need to draw one control only it shouldn’t be inside a group, once it’s in a group it should only be drawn by the group


#4

I see. The problem is that the GUI is becoming huge and I need to draw only certain groups otherwise there is no space. I am also using loadFromFile to store all the settings, therefore I can not create different ofxPanel.


#5

you can override the save method using the loadPressedE and savePressedE events in ofxPanel: https://github.com/openframeworks/openFrameworks/blob/patch-release/addons/ofxGui/src/ofxPanel.h#L25-L26

then use mutiple panels or a panel and multiple groups to save all of the at once when the save button in the main one is pressed


#6

But how can i save and load, all the parameters stored in several ofxPanels to a single file?


#7

just call manually loadFromFile and saveToFile passing the same file. as long as there’s not parameters with the same name it should be fine


#8

It works, thanks :wink: