Re: Eu2.1: get_key(): how know when RELEASED
- Posted by "Hawke'" <mikedeland at NETZERO.NET> Aug 26, 2000
- 443 views
from keyread.e in the archive: -- Here's an extremely useful library routine for reading the keyboard. -- It is used just like get_key(), except that it's called get_keys(), -- it returns a sequence instead of an atom, and the values returned are -- scan codes, instead of ASCII codes. -- The advantage is that the routine will recognize multiple keypresses -- at the same time, and return them in one sequence. -- Also, there is no repeat delay, instead the code is returned constantly -- until the key is released. -- Finally, the routine is also some 10-20 times faster than get_key() -- Regards, -- Michael Bolin -- June 1997 hope this helps, Hawke' ----- Original Message ----- From: irv <irv at ELLIJAY.COM> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Saturday, August 26, 2000 2:26 PM Subject: Re: Eu2.1: get_key(): how know when RELEASED > On Sat, 26 Aug 2000, Dan wrote: > > Anyone know how I can tell when a key is RELEASED? As far as I can tell, > > get_key returns a bunch of -1's even when a key IS pressed, and tosses in > > the actual key pressed every once and a while; it does that fast enough & > > often enough to allow "if get_key() != -1" to pick up the sporadic instance > > of not -1 when it occurs, but makes an "else =-1" not able to signify no > > key pressed, because of all the -1's spit out along even when an actual key > > is pressed. > > > > Am I misunderstanding something here? > > Only in that the key _isn't_ pressed, even if you're sitting on it, if you have > keyboard repeat turned on. The repeat function "releases" and "presses" the key > a few times a second as long as you hold the key down. > > That's why you get the key val, followed by -1's, then the key, etc. > > I think (someone will correct me if I'm wrong) you'll have to go to a lower > level (dos interrupts) to get a key-release code. Will that work without > turning off the auto-repeat ? > > Irv > ____________NetZero Free Internet Access and Email_________ Download Now http://www.netzero.net/download/index.html Request a CDROM 1-800-333-3633 ___________________________________________________________