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 & HelpSyntax Questions › Typo with ControlP5
Page Index Toggle Pages: 1
Typo with ControlP5 (Read 550 times)
Typo with ControlP5
May 13th, 2009, 10:19am
 
Hello

does maybe anybody know how can I with ControlP5 TextField, a text displaying?

I have this simple code: / the problem is how to display the
typed String textValue.....





import controlP5.*;

ControlP5 controlP5;

int myColorBackground = color(0,0,0);

String textValue = "";

Textfield myTextfield;

void setup() {
 size(400,400);
 PFont font = loadFont("Ziggurat-HTF-Black-32.vlw");
 textFont(font,20);
 
 frameRate(25);
 controlP5 = new ControlP5(this);
 myTextfield = controlP5.addTextfield("texts",100,160,200,20);
 myTextfield.setFocus(true);
 controlP5.addTextfield("textValue",100,200,200,20);
}

void draw() {
 background(myColorBackground);
 
 text("textValue",mouseX,mouseY);
}


void controlEvent(ControlEvent theEvent) {
 println("abc");
}

void mousePressed() {
myTextfield.getText();
}


public void texts(String theText) {
 println("a textfield event. "+theText);
 println("textValue : "+textValue);
}


Cheesy
Re: Typo with ControlP5
Reply #1 - May 16th, 2009, 9:17pm
 
this helps?

Code:

import controlP5.*;

ControlP5 controlP5;
Textfield myTextfield;

void setup() {
size(400,400);
PFont font = createFont("Arial",20); //loadFont("Ziggurat-HTF-Black-32.vlw");
textFont(font,20);
frameRate(25);
controlP5 = new ControlP5(this);
myTextfield = controlP5.addTextfield("texts",100,160,200,20);
myTextfield.setFocus(true);
}

void draw() {
background(0);
fill(255);
text(myTextfield.getText(),10,50);
}



best,
andreas

Page Index Toggle Pages: 1