Problem with ControlP5, Scrollablelist and align method

Hi everyone,

I have trouble aligning text in a scrollable list in the ControlP5 library.

Here is an example :

import controlP5.*;
import java.util.*;

ControlP5 cp5;

void setup() {
  size(400, 400);
  cp5 = new ControlP5(this);
  List l = Arrays.asList("a", "b", "c", "d", "e", "f", "g", "h");

  cp5.addScrollableList("dropdown")
     .setPosition(100, 100)
     .setSize(200, 100)
     .setBarHeight(20)
     .setItemHeight(20)
     .addItems(l);
     
  cp5.getController("dropdown").getCaptionLabel().setColor(color(255,0,0));
  cp5.getController("dropdown").getCaptionLabel().alignX(ControlP5.RIGHT);
}

void draw() {
  background(240);
}

If you run it, you can see that the color of the text is red (so “setColor” works) but the alignement stays left…

Am I doing something wrong or is it just not supported by the library ?

Thanks in advance for your time,

Have a nice day =)

It works with matrix but doesn’t with scrollableList for some reason.

  cp5 = new ControlP5(this);
  cp5.addMatrix("mm")
     .setPosition(50, 50)
     .setGrid(9, 9)
     .getCaptionLabel()
     .setColor(#FF00FF)
     .alignX(RIGHT);
  
  cp5.addScrollableList("dd")
     .setPosition(50, 200)
     .addItems(Arrays.asList("a", "b", "c"))
     .getCaptionLabel()
     .setColor(#FF00FF)
     .alignX(RIGHT);

1 Like