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 › Disable quit on 'esc' key.
Page Index Toggle Pages: 1
Disable quit on 'esc' key. (Read 702 times)
Disable quit on 'esc' key.
Nov 4th, 2007, 8:56pm
 
Hello,

I'm using processing inside netbeans, but I guess this questions applies to all processing programs. Is there any way to disable quitting the program when the esc key is pressed?

I tried looking in the previous posts, but didn't come up with an answer?

kind regards,
Robin.
Re: Disable quit on 'esc' key.
Reply #1 - Nov 5th, 2007, 4:29am
 
A bit of a hack but this will work (tested)

Code:

void keyPressed(){
if(key==27)
key=0;
}


You can still get Esc to do something useful, but it prevents the key from being passed down as a quit command.

~M
Re: Disable quit on 'esc' key.
Reply #2 - Nov 5th, 2007, 2:29pm
 
that's the sanctioned method, not just a hack:
http://processing.org/reference/environment/export.html#present
Re: Disable quit on 'esc' key.
Reply #3 - Nov 5th, 2007, 5:42pm
 
Thanks so much...don't know why I didn't think of that myself!


kind regards,
Robin.
Page Index Toggle Pages: 1