zoomx / controlp5

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

Console Output before button is pressed #66

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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

Original issue reported on code.google.com by mo...@gmx.de on 10 Nov 2012 at 5:55

GoogleCodeExporter commented 9 years ago
I 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);

Original comment by iwan.san...@gmail.com on 15 Nov 2012 at 2:32

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hi, this is actually a feature rather than a bug. you can disable the auto 
initialization of controllers when created by using 
controP5.setAutoInitialization(false); 

Original comment by soj...@gmail.com on 19 Nov 2012 at 3:30