ofxUI / change a labeltoggle value by code

after to have created by gui, I want to be sure 2 label toggles are off.
so I tried this:

ofxUILabelToggle *helpMenu = (ofxUILabelToggle*)gui->getWidget("HELP");  
ofxUILabelToggle *menu = (ofxUILabelToggle*)gui->getWidget("MENU");  


any other way ?

Curious, it works for me.

Could you post a complete code example ?

The line below also work

((ofxUITextInput *)gui->getWidget("TEXT INPUT"))->setAutoClear(false);  

if you want to set autoClear to false for a text input.


gives an error.

It’s always difficult to help with little part of code.
Anyway, please find attached an xcode project where I put your two lines, and it works.


I can’t paste the whole stuff… tooooo huge.
BUT, I found something that works fine in my case: when I create the button, I can pass the initial state which is enough in my case.

I used this kind of line to set the initial state of many of my widgets with succes.