ofxUI Addon (slider, canvas, dropdownlist)

Hello everyone.

I have two questions that probably someone here know the answers.

The first one is:
Does anyone know how can I remove a label that display the value from a vertical slider?

The second one is:
I add a dropDownList to a canvas and then set it visible.
After this I add other canvas and set it also visible.
When I open the dropDowList, the elements from it display under the second canvas and i want it to display over.
There is any option to set the z coordinate or something like that?

Thanks for your time and help,

You can hide the label with setLabelVisible

ofxUISlider * slider = gui->addSlider("hello", 5.0, 10.0, 8.0, 20, 100);

@genekogan Thank you for your reply.

Well, actually I have tried it but doesn’t work.
My code is:

ofxUISlider* slid = slide->addSlider("SLIDE", 0.0, numberOfLines, &line, 5, height - height/2);

Where line is a float and “height - height/2” is higher than 5, so its vertical.
And the value that I’m talking about, is the value that appears when you drag the mouse over the slide.

Thank you for your time.

Sorry for adding 2 more questions about ofxUIDropDownList, but i guess we’re in similar threads … so i add it to this thread.

1/ My concern is that when a ofxUIDropDownList displays unfolded and you have some other widgets on the same canvas after it, so they are behing it, when you select a new item from the dropdown, the widget that is below the selected item is also hit by the mouse press …

This is very annoying … is it possible to cut this behaviour where clicking on the dropdown it does not click what is behind it ?

2/ When I save the canvas via :


and then load it again with :


the dropdown list doesn’t get to load properly … that is that when it loads, the dropdown list doesn’t get updated to the values i had when saving… Looking at the XML i see that the ofxUIDropdown list just records :

    <Name>Renderer Type</Name>

Is there a way that the ofxUIDropDownlist gets updated when loading the settings or preset from a XML file ?

Thanks a lot :open_hands:


In regards to your first question:

I think it’s best to keep your layout single-layered, as in don’t overlap widget. The ofxUI uses binds to the GLFW mouse events through callbacks and iterates through all widget to see if a mouse position is over a certain widget. It’s normal that of two widgets overlap, they are both marked as selected. Maybe you can play with the setVisible() method to disable all other dropdowns when you select one. Also, the setState() function can also be of use, as in setting all other dropdowns to not being hovered, while you hover one…


Up. So no one know how to hide the value from the slide?

Thanks for your time,

A quick look at the ofxUI source code yields the following: comment out or encapsulate by a bool condition the following lines of code: ofxUISlider.cpp lines 286-290

            label->drawString(rect->getX()+rect->getWidth()+padding, label->getRect()->getHeight()/2.0+rect->getY()+rect->getHeight()-rect->getHeight()*MIN(MAX(value, 0.0), 1.0), valueString);

Hello Vjacobs.

Yap, it works… Shame on me, didnt see it. Thank you.

By the way, and since I’m asking things about ofxUI, does anyone know if it’s possible to display something “saying” that one ofxUIScrollableCanvas is actually scrollable? I’m asking this because people don’t know that canvas is scrollable just looking at.