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_
   Suggestions
   Software Suggestions
(Moderator: fry)
   keyboard special keys
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: keyboard special keys  (Read 484 times)
Josh Nimoy

jtnimoy WWW Email
keyboard special keys
« on: Jan 29th, 2003, 11:09am »

on a PC, all the special keys (F1, arrows, ctrl, shift) all show up as key 65535 in Proce55ing. If 65535 also occurs similarly for other OSes, perhaps then is would be nice to have a specialKey() function to retrieve the value, should key ever be 65535.
 
I would love to have at least the arrow keys.
 
fry


WWW
Re: keyboard special keys
« Reply #1 on: Jan 30th, 2003, 3:25am »

yep.. under java, there's a distinction between the key 'char' (which is what we provide with the 'key' variable) and the key 'code', which is a special constant for all the odd characters.  
 
since more people seem to want to do this, we should add keyCode as a variable as well (will try that for 51/52).  
 
in the meantime, check out this discussion for info on how to do it:
http://proce55ing.net/discourse/yabb/board_Syntax_action_displa_y_num_1042156938.html
 
fry


WWW
Re: keyboard special keys
« Reply #2 on: Jun 25th, 2003, 8:42pm »

i've added in support for handling ALT, CONTROL, SHIFT and the arrow keys (UP, DOWN, LEFT, RIGHT) without all that extra difficulty for 56.
 
skloopy

WWW
Re: keyboard special keys
« Reply #3 on: Nov 16th, 2003, 10:09am »

With the new code for UP, DOWN, etc.. how would i pass the "key" variable to a function like this:
 
Code:
void keyTyped()
{
  typeKey(key);
}
 
void typeKey(??int?? key)
{
  switch(key) {
    case DOWN: make some crepes; break;
  }
}

the ?? is just cause i don't know what type to cast it as, because it doesn't seem to keep the DOWN connection once it gets passed as an int.
 
REAS

WWW
Re: keyboard special keys
« Reply #4 on: Dec 16th, 2003, 7:03pm »

int is correct. it's working in this example:
 
Code:

void keyPressed()  
{
  passedkey(key);
}
 
void passedkey(int keyin)  
{
  println(key);
  if(key == DOWN) {
    println("DOWN");
  }
}
 
REAS

WWW
Re: keyboard special keys
« Reply #5 on: Dec 16th, 2003, 7:05pm »

also working here:
 
Code:

void keyPressed()  
{
  passedkey(key);
}
 
void passedkey(int keyin)  
{
  println(key);
  //if(key == DOWN) {
  //  println("DOWN");
  //}
  switch(key) {
    case DOWN:
 println("DOWN");
 break;
  }
}

 
skloopy

WWW
Re: keyboard special keys
« Reply #6 on: Dec 16th, 2003, 11:33pm »

Thanks Casey. Sorry I figured out that it was just that I was using "keyTyped()" instead of "keyPressed()" in this post:
 
http://proce55ing.net/discourse/yabb/board_Proce55ing_software__bugs_action_display_num_1070996005.html
 
I'm still not sure what the difference is between them, but key typed seemed more appropriate
 
ryan
 
Pages: 1 

« Previous topic | Next topic »