ofxUI / change a labeltoggle value by code

Hello,
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");  
helpMenu->setValue(false);  
ofxUILabelToggle *menu = (ofxUILabelToggle*)gui->getWidget("MENU");  
menu->setValue(false);  

EXEC_BAD_ACCESS

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.

((ofxUILabelToggle*)gui->getWidget(“HELP”))->setValue(false);
((ofxUILabelToggle*)gui->getWidget(“MENU”))->setValue(false);

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.

example-ofxUIButtons.zip

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.
Thanks