lichtungsgnarr / controlp5

Automatically exported from code.google.com/p/controlp5
0 stars 0 forks source link

Cannot display custom images for Toggle Controller in second tab #87

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Processing 2.1.1, Windows 7, ControlP5 2.0.4

I am using two tabs, TAB 1 and TAB 2. I have made 2 custom toggle buttons, 
Toggle1 and Toggle2. The only difference between Toggle1 and Toggle2 is that 
Toggle2 has been moved to TAB 2 using .moveTo("TAB 2"). The resulting problem 
is that Toggle2 does not display the custom images, and just shows up as a 
white box that does not update its visual mode when clicked. Has anyone 
encountered this before? Here is my code:

import controlP5.*;

PImage offPic, onPic;
ControlP5 cp5;

void setup() {
    size(600, 800);
    offPic = loadImage("images/white_unselected.png");
    onPic  = loadImage("images/white_selected.png");

    cp5 = new ControlP5(this);

    cp5.getTab("default")
       .activateEvent(true)
       .setLabel("TAB 1")
       .setId(1);

    cp5.addTab("TAB 2")
       .activateEvent(true)
       .setId(2);

    cp5.addToggle("Toggle1")
       .setPosition(20, 20)
       .setImages(offPic, onPic, onPic)
       .updateSize();

    cp5.addToggle("Toggle2")
       .setPosition(100, 100)
       .setImages(offPic, onPic, onPic)
       .updateSize()
       .moveTo("TAB 2");
}

void draw() {
    background(0);
}

Original issue reported on code.google.com by lenpelle...@gmail.com on 28 Jan 2014 at 12:40