Hi,
It seems that the number of the imagebutton is changed from #00001
to #00010, when I include later code that calls a class that extends EmbeddedSketch, so the result of the void handleImageButtonEvents is affected...
for example, in normal case,
a) If I create a button named mybutton1, then I press over the button, the value passed to the handle is:
imagebuton#00001 GImageButton (24)
mybutton1#00001 GImageButton (24)
handle in mybutton1,ok
BUT
b) when I add later a class that extends, the result is different:
imagebuton#00001 GImageButton (24)
mybutton1#00010 GImageButton (24) <--here the button number has been changed ,& the resulted is wrong
out of mybutton1,it is wrong
It is the same code, with 2 different results:
void setup(){
files = new String[]{ "bus6.png", "bus10.jpg", "bus9.jpg" };
mybutton1 = new GImageButton(this, "blanco110x134.png", files, 500,14);
}
void handleImageButtonEvents(GImageButton imagebutton) {
println("imagebuton"+imagebutton);
println("mybutton1"+mybutton1);
if(imagebutton == mybutton1){
lblOut.setText("In my button1");
println("handle in mybutton1,ok"); //normal case, it enters here
}
else
{ println("out of mybutton1,it is wrong");} //in extended class, it enters here
}
1