nedomozg
YaBB Newbies
Offline
Posts: 2
Re: controlP5
Reply #86 - Aug 28th , 2008, 9:58pm
Hello everyone! Sorry for my english at first. I found processing some weeks ago and controlP5 library is very cool. What I tried to do is 3d sketch with GUI in controlwindow. Sliders work perfect, but I have a problem with textfield located in control window. Its just not working. No events detected while typing. I tried focus. I found groupCanvas example and it is for "plan B". But is there any simple solving. Im doing like this. Thanks for any replys. import controlP5.*; ControlP5 controlP5; ControlWindow controlWindow; String textValue = ""; Textfield myTextfield; public int sliderValue = 40; void setup() { size(400,400); frameRate(25); controlP5 = new ControlP5(this); controlP5.setAutoDraw(false); controlWindow = controlP5.addControlWindow("controlP5window",100,100,400,400); controlWindow.setBackground(color(40)); Controller mySlider = controlP5.addSlider("sliderValue",0,255,40,40,100,10); mySlider.setWindow(controlWindow); myTextfield = controlP5.addTextfield("texts",40,70,200,20); myTextfield.setFocus(true); myTextfield.setWindow(controlWindow); } void draw() { background(sliderValue); controlP5.draw(); texts(myTextfield.getText()); } void controlEvent(ControlEvent theEvent) { println("got an event from "+theEvent.controller().name()); println(theEvent.controller().stringValue()); } void mousePressed() { println(myTextfield.getText()); } public void texts(String theText) { println("a textfield event. "+theText); println("textValue : "+textValue); }