Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

controlP5 problem.

$
0
0

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.

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

but this not:

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



    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", " "))
      ;

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


anybody know why?

Viewing all articles
Browse latest Browse all 2896

Trending Articles