Toggle Text on controlP5

So I’m using a library called controlP5 for a project I’m doing. I’m making a menu where I use conrtolP5’s buttons and toggles. The buttons work fine but I’m having a problem with the toggles. The buttons have the name of the button labelled ontop of the button itself while the toggle places the label below the toggle. I was wondering how I could move the label to the middle of the toggle similarly to how the button is? Here is the code I’m using for the toggle:

boolean items = true;
Width = 1280;
Height = 720;

cp5.addToggle("Items")
.setBroadcast(false)
.setValue(items)
.setBroadcast(true)
.setPosition(Width/10,Height <em>6/10)
.setSize(Width</em> 8/10,Height/10)
.setColorBackground(color(255,0,0))
.setColorActive(color(110,160,255))
.getCaptionLabel()
.setFont(font)
.toUpperCase(false)
;
1 Like

i do have limited effects with using

.setCaptionLabel("\n                        my Items Label")
.align(0,0,0,1)
.setColorLabel(color(0,200,0)) 

but why you not use your button
and change the logic to ON OFF with color change background and text change START / STOP…

1 Like

I was looking for the toggle to change colour when activated and deactivated so that why I used one instead of a toggle. I wasn’t able to use your code exactly but showing me the .align command really helped as I figured out how to fix it. So for anyone else with a similar issue all you need to do is add “.align(ControlP5.CENTER,ControlP5.CENTER)” on the line after “.toUpperCase(false)”. Thank you for your help kll.