please format code with </> button * homework policy * asking questions
I’m trying to make a panel of toggles that can be affected/changed by buttons, like setting multiple toggles’ state from false to true using one button, while still being able to use individual toggles.
Here is how I am making each toggle:
cp5.addToggle("one")
.setPosition(100, 100)
.setSize(200, 200)
.setFont(font)
.setValue(false)
.setColorBackground(selectColor)
.setColorForeground(basicColor)
.setColorActive(toggleColor);
Here is how I am checking each toggle:
void one(boolean theFlag){
if (theFlag == true)
{
port.write('A');
}
if (theFlag == false)
{
port.write('a');
}
}
I want to be able to change the state of several toggles with one button, not just setting it to a default state.
When I try cp5.getController("one").setValue(cp5.getController("one").getDefaultValue());
I can set each toggle to false, as this is the default state, but when I try `cp5.getController(“one”).setValue(true)’ it says it won’t take a boolean, despite the default value returning a boolean.
How do I change these toggles “remotely?”