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 › key combinations like ALT+a
Page Index Toggle Pages: 1
key combinations? like ALT+a? (Read 1832 times)
key combinations? like ALT+a?
Jun 2nd, 2005, 3:10am
 
hey ho! I wondered how if I could code a piece in the way that some actions whould happen if I push ALT and 'a' at the same time etc. This would be really cool. I want to use processing as displayer for some animations and as a GUI for Supercollider (SC3) at the same time for a live performance. So I need a lot of "buttons". Any help is appreciated
Re: key combinations? like ALT+a?
Reply #1 - Jun 2nd, 2005, 11:51pm
 
you can use the keyCode variable:
http://processing.org/reference/keyCode.html

or for full control, use java's methods for getting info from a KeyEvent object, which is updated on each key event inside processing, and available as a variable called "keyEvent". i.e.
int c = keyEvent.getKeyChar();
Re: key combinations? like ALT+a?
Reply #2 - Jun 3rd, 2005, 1:52am
 
thank U!
I found it out bymyself.
U can use œ as a key variable Smiley
œ = ALT Q in my keyboard..
cheers
Re: key combinations? like ALT+a?
Reply #3 - Jun 16th, 2005, 6:32am
 
but how can I identify inside the keyevent the key im pressing, for making some ifs results?
The other part, how can i say to proccessing, if F1 or F2 or Cpas LOck or print screen is pressed, do anything, where can i find the code for doing those things? i ve seen something like the equivalency on Ascii numbers but where is some chart or anything to do it?
the keyevent works on the alpha version?
Re: key combinations? like ALT+a?
Reply #4 - Jun 16th, 2005, 4:11pm
 
see the java documentation on using keyEvent:
http://java.sun.com/j2se/1.3/docs/api/java/awt/event/KeyEvent.html

then implement via something like this:

void keyPressed() {
 // "key" has the keyEvent.getKeyChar();
 // "keyCode" has keyEvent.getKeyCode();
 // if you want any of the other info, you can use the
 // "keyEvent" object that's built into processing
}
Re: key combinations? like ALT+a?
Reply #5 - Jun 17th, 2005, 5:21am
 
hey truly thanks, now im up to something, i was kinda lost, thanks
Page Index Toggle Pages: 1