controlp5
controlp5 copied to clipboard
Typing characters with accent marks in a textbox
The controlp5 library is amazing, and I just want to say thanks for putting it together.
Is there a way to write special characters in controlp5? Currently, I am trying to create a textbox that searches for names in a list. Some of the names include characters from the Spanish alphabet, such as 'ó' in López, but I am having trouble typing them as a single character. If I try to type the character 'ó' it appears as the two separate characters ' and o.
I have added a PFont that includes all characters, and I have changed my keyboard to Spanish. I am using a PC and Processing v. 2.2.1.
At the moment, I am only using the example textbox found in the documentation.
void setup() { PFont font = loadFont("myarial.vlw"); cp5 = new ControlP5(this);
cp5.addTextfield("input") .setPosition(20, 100) .setSize(200, 40) .setFont(font) .setFocus(true) .setColor(color(255, 0, 0)) ;
cp5.addTextfield("textValue") .setPosition(20, 170) .setSize(200, 40) .setFont(font) .setAutoClear(false) ;
cp5.addBang("clear") .setPosition(240, 170) .setSize(80, 40) .getCaptionLabel().align(ControlP5.CENTER, ControlP5.CENTER) ;
cp5.addTextfield("default") .setPosition(20, 350) .setAutoClear(false) ;
textFont(font);
}
void draw() { background(0); rect(10, 100, 50, 50); if (foo) { background(0); fill(255); text(cp5.get(Textfield.class, "input").getText(), 360, 130); text(textValue, 360, 180); } }
Hello, I don't have a quick fix for this and would need to look into it, though I can give you a timeframe for this.
Hello and thank you for getting back to me. Yes, please let me know how much time it will take. Thanks again.
Hello, About that time frame 😄 I'm developing a database for my workplace and Portuguese also uses a lot of accents. Is it feasible for controlP5 textfield to accept those characters?
I've been using your library a lot lately and my thanks and congratulations for the accomplishments. Cheers, Xavit
In pure Processing, I'd need to replace callback keyPressed() w/ keyTyped() in order for "system" variable key to get an accented character.
https://Processing.org/reference/keyTyped_.html