[ControlP5] Change the Tab-Order ?!

edited August 2014 in Library Questions

how can i change the order from the tabs? (specially for the default-tab)

import controlP5.ControlP5;
ControlP5 cp5 = new ControlP5(this);

cp5.addTab("tab1");
cp5.getTab("default").setTitle("tab2");
cp5.addTab("tab3");

it appears:

tab2, tab1, tab3

but i want the default-tab is on the second position.

Answers

  • You can't. But you can remove the default tab and just use all of your own, since there is no benefit to the default tab anyway.

    Code Example

    import controlP5.ControlP5;
    ControlP5 cp5;
    
    void setup() {
      size(700, 700);
      cp5 = new ControlP5(this);
      cp5.getTab("default").setVisible(false);
      cp5.addTab("tab1");
      cp5.addTab("tab2");
      cp5.addTab("tab3");
    }
    
    void draw() {
      background(0);
    }
    
  • Or rename the default one to tab1.

      cp5.getTab("default").setTitle("tab1").setPosition(50, 50);
      cp5.addTab("tab2");
      cp5.addTab("tab3").setPosition(50, 50);
    
  • edited August 2014

    @ amnon: i had this before. ;)
    but now i want to use "default", cause then i don't have to say to each controller "moveTo(tab2)"

    @ clankill3r: :)>- yes, but then you can not switch tab1 with tab2

Sign In or Register to comment.