sojamo / controlp5

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

Processing ControlP5 Issue - no other term for it #180

Open dnspikaia opened 1 year ago

dnspikaia commented 1 year ago

Hi tried to change labels of cp5 sliders. Used the code by sojamo. Dragged and dropped the "reposition label" - code by sojamo into my code twice. One works, the other one doesn`t. The slider is called properly - if I replace the .getCaption... -part with something like .setColor(..) it simply works.

I checked the whole program, all tabs, there is no other part in the code that anyhow interacts with the labels of the control panel. Anyone any idea what might be wrong??? (sorry for the freaky names, its for german speaking people)

// sliders cp5.addSlider("Wand_Breite") .setPosition(180, 165) .setWidth(200) .setColorActive(color(55)) .setColorForeground(color(100)) .setColorBackground(color(155)) .setRange(1, 10) .setValue(1) .setNumberOfTickMarks(10) .setSliderMode(Slider.FLEXIBLE);

// reposition the Label for controller 'Wand_Breite'
// This part works
cp5.getController("Wand_Breite").getValueLabel()
  .align(ControlP5.LEFT, ControlP5.TOP_OUTSIDE).setPaddingX(0);
cp5.getController("Wand_Breite").getCaptionLabel()
  .align(ControlP5.RIGHT, ControlP5.TOP_OUTSIDE).setPaddingX(0);

cp5.addSlider("Aktive_Wand")
  .setPosition(180, 210)
  .setWidth(200)
  .setColorActive(color(55))
  .setColorForeground(color(100))
  .setColorBackground(color(155))
  .setRange(0, 1)
  .setValue(0)
  .setNumberOfTickMarks(2)
  .setSliderMode(Slider.FLEXIBLE);

// reposition the Label for controller 'Aktive_Wand'
// This does not. ..? ....????!!!!!
cp5.getController("Aktive_Wand").getValueLabel()
  .align(ControlP5.RIGHT, ControlP5.BOTTOM_OUTSIDE).setPaddingX(0);
cp5.getController("Aktive_Wand").getCaptionLabel()
  .align(ControlP5.RIGHT, ControlP5.BOTTOM_OUTSIDE).setPaddingX(0);
Ohne Titel