controlP5 listBox and buttonBar problem


I`ve a problem with controlP5 library. In a json file i stored the value of a variable of a class name “layer”, witch is equal to buttonBar choice.

buttonBar = layer

Next, i want to load that value, but i cant make that buttonBar set the value and display on… the same is happening with a listBox.

but no with sliders: this works perfectly. (t2) is a slider.

float T2 = shader.getFloat("t2"); // value load from  JSON file

buttonBar, not working

int n = numberLayer.getInt("numberLayer");
shaderWin.cpp5.getController("l").setValue(n); // "l"  is a buttonBar. i want the item number N on.

      .setPosition(0, 0)
      //.setSize(1000, 20)
      .addItems(split("0 1 2 3 4 5 6 7 8", " "))
  void l(int n) {
    println("bar clicked, item-value:", n);
    layer.layer = n;

anybody know why?