sojamo / controlp5

A gui library for processing.org
GNU Lesser General Public License v2.1
490 stars 142 forks source link

Toggle Text Box #150

Closed Coolconor98 closed 5 years ago

Coolconor98 commented 5 years ago

I'm trying to add a toggle where the toggle name is on the toggle box similarly to how it works with buttons instead of it being beneath it. I've searched the various formus and the controlP5 website for the last few hours and I'm unable to find a solution. Here's an example of the code:

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

cp5.addToggle("Items") .setBroadcast(false) .setValue(items) .setBroadcast(true) .setPosition(Width/10,Height6/10) .setSize(Width8/10,Height/10) .setColorBackground(color(255,0,0)) .setColorActive(color(110,160,255)) .getCaptionLabel() .setFont(font) .toUpperCase(false) ;

Coolconor98 commented 5 years ago

I figured out how to do it with the help of another person on a forum. 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)”.