We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › MyGUI - sending data
Page Index Toggle Pages: 1
MyGUI - sending data (Read 318 times)
MyGUI - sending data
Oct 2nd, 2006, 8:47am
 
I have made a simple interface using myGUI, which will eventually send data when buttons are clicked.

however i am having some trouble just printing a line when the buttons are clicked. when you click the buttons, a line should print "pressed 1" or "pressed 2". but nothing happens.

Code:


import mkv.MyGUI.*;

MyGUI gui;
MyGUIStyle style1, style2;
MyGUIButton b1, b2;

void setup(){
gui = new MyGUI(this);
MyGUIStyle style1 = new MyGUIStyle(this);
MyGUIStyle style2 = new MyGUIStyle(this);
MyGUIButton b1 = new MyGUIButton(this,20,10,"one",30,10);
MyGUIButton b2 = new MyGUIButton(this,20,30,"two",30,10);

style1.background = color(0,0,0);
style1.buttonFace = color(255,255,255);
style1.buttonHighlight = color(33,66,99);
style2.background = color(66,66,66);
style2.buttonFace = color(188,188,188);
style2.buttonHighlight = color(99,66,33);

b1.setStyle(style1);
b2.setStyle(style2);

gui.add(b1);
gui.add(b2);

}

void draw(){
}
void actionPerformed(ActionEvent e) {
if(e.getSource() == b1) {
println("PRESSED 1");
}
else if(e.getSource() == b2) {
println("PRESSED 2 ");
}

}

Page Index Toggle Pages: 1