Export to GitHub

controlp5 - issue #86

bringToFront() method does not completely change a Tab directly


Posted on Dec 30, 2013 by Massive Wombat

/* * To reproduce the problem: * 1. Run sketch. * 2. Press Tab to go to extra tab (see the Button disappear). * 3. Click inside the Button area (which for this example is quite big ;-) * 4. Notice that the Button still works ONCE! It generates an event and changes the background color. */

import controlP5.*; ControlP5 cp5;

int myColorBackground = 0;

void setup() { size(600, 600); noStroke(); cp5 = new ControlP5(this); cp5.addTab("extra");
cp5.addButton("button") .setPosition(50, 50) .setSize(width-100, height-100) .getCaptionLabel().align(CENTER, CENTER); }

void draw() { background(myColorBackground); }

void button() { myColorBackground = 255 - myColorBackground; println("Button pressed! Setting background to: " + myColorBackground); }

void keyPressed() { if (keyCode == TAB) { // PROBLEM: the bringToFront() method does not do everything needed to change a tab cp5.getTab("extra").bringToFront(); } }

What is the expected output? What do you see instead? Expected is that the controllers from the old, invisible Tab no longer work. Instead they still work for one click.

What version of the product are you using? On what operating system? ControlP5 2.0.4 on Processing 2.1 on Win8 x64.

Please provide any additional information below. I'm using ControlP5 once again for a project (my biggest creative project to date!) and once again it's working great. This is just a minor issue that hopefully can be fixed in a future release.

Status: New

Labels:
Type-Defect Priority-Medium