What steps will reproduce the problem? 1. Open up a GUI with a Button 2. Attach a function that is called by the button with println() 3. Compile and take a look at Console output
What is the expected output? What do you see instead? There is an output when the program starts, but no button is pressed.
What version of the product are you using? On what operating system? I'm using Processing 2.06b6
Please provide any additional information below. Here you can take a look at the source: https://gist.github.com/4051351
Comment #1
Posted on Nov 15, 2012 by Grumpy LionI don't know if this is the intended mechanism, but the event listener's function is called not only when the button is pressed, but also when setValue() is called.
One workaround is to temporary disable the event broadcast when calling the setValue() function: gui.getController("PressMe").setBroadcast(false); gui.getController("PressMe").setValue(0); gui.getController("PressMe").setBroadcast(true);
Comment #2
Posted on Nov 19, 2012 by Happy HippoComment deleted
Comment #3
Posted on Nov 19, 2012 by Happy RhinoHi, this is actually a feature rather than a bug. you can disable the auto initialization of controllers when created by using controP5.setAutoInitialization(false);
Status: WontFix
Labels:
Type-Defect
Priority-Medium