# controlP5 listBox and buttonBar problem

**URL:** <https://discourse.processing.org/t/controlp5-listbox-and-buttonbar-problem/1585>\
**Category:** Libraries\
**Created:** [July 8, 2018, 2:27am UTC](https://discourse.processing.org/t/controlp5-listbox-and-buttonbar-problem/1585 "2018-07-08T02:27:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vjjv](https://avatars.discourse-cdn.com/v4/letter/v/df705f/32.png) [@vjjv](https://discourse.processing.org/u/vjjv)\
**Post date:** [July 8, 2018, 2:27am UTC](https://discourse.processing.org/t/controlp5-listbox-and-buttonbar-problem/1585/1 "2018-07-08T02:27:39Z")

</div>

hello!

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.

```auto
float T2 = shader.getFloat("t2"); // value load from JSON file
shaderWin.cpp5.getController("t2").setValue(T2);

```

buttonBar, not working

```auto

```

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

```

```auto

    cpp5.addButtonBar("l")
      .setPosition(0, 0)
      .setFont(font)
      //.setSize(1000, 20)
      .setWidth(900)
      .setColorBackground(0)
      .addItems(split("0 1 2 3 4 5 6 7 8", " "))
      ;

```

```auto
  void l(int n) {
    println("bar clicked, item-value:", n);
    layer.layer = n;
  }

```

anybody know why?
