i’d like to use controlP5’s Tabs.
and i’d like to have some GUI elements showing up in all tabs (that is exist on the “global” tab)
but i DON’T want those elements to overlay everything else.
i thought bringToFront()
would be the appropriate method. but it seems the “global” tab stays in front of everything else, no matter what…
is any there anything else i can do, to manipulate the “z-index” of controlP5 elements?
import controlP5.*;
ControlP5 cp5;
ScrollableList dropdown1, dropdown2;
void setup() {
size(300, 400);
cp5 = new ControlP5(this);
cp5.addTab("extra").activateEvent(true);
dropdown2 = cp5.addScrollableList("dropdown2")
.setPosition(100, 105)
.setColorBackground(color(60));
;
dropdown1 = cp5.addScrollableList("dropdown1")
.setPosition(50, 50)
;
for (int i=0; i<40; i++) {
dropdown1.addItem("thing "+i, i);
dropdown2.addItem("item "+i, i);
}
cp5.getController("dropdown2").moveTo("global");
cp5.getController("dropdown1").moveTo("extra");
cp5.getController("dropdown1").bringToFront();
cp5.getTab("extra").bringToFront();
}
void draw() {
background(0);
if (dropdown1.isMouseOver()) {
println(frameCount + " go to front");
dropdown1.bringToFront();
}
}
void controlEvent(ControlEvent theControlEvent) {
if (theControlEvent.isTab()) {
if (theControlEvent.getTab().getName() == "extra")
{
println("bring to front");
dropdown1.bringToFront();
}
}
}