FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Syntax
(Moderators: fry, REAS)
   text input
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: text input  (Read 380 times)
_cory

WWW
text input
« on: Mar 3rd, 2003, 5:19pm »

i'm trying to write a tool for text visualization and i'm hoping to use keyboard input (i.e. typing) as the primary means of input. i've done a simple 2d prototype using a java applet/canvas and text events. I was hoping to make a better version with proce55ing but have only found the key,keyPressed and keyReleased code for getting text input. When i use these in a loop like so
 
if(keyPressed){
 
   story = story + char(key);
 
}
 
the applet seems to skip a lot of characters (i think when i type the key isn't pressed long enough to register inbetween redraws, but i'm just guessing).  
 
Is there a better way to do this, or is there an easy way to integrate the java applet proce55ing generates into a canvas so i can use a real text field (with cut-and-paste capabilities) for input?
 
REAS


WWW
Re: text input
« Reply #1 on: Mar 3rd, 2003, 5:51pm »

this will be fixed by using the keyPressed() function for grabbing the characters. see the great example by josh nimoy:
http://www.proce55ing.net/learning/examples/typography05.html
 
_cory

WWW
Re: text input
« Reply #2 on: Mar 3rd, 2003, 6:02pm »

ahh. overloading the keyPressed() method. thanks, works like a charm.
 
 
Pages: 1 

« Previous topic | Next topic »