1. Eu2.1: get_key(): how know when RELEASED
- Posted by Dan B Moyer <DANMOYER at PRODIGY.NET> Aug 26, 2000
- 453 views
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? Dan
2. Re: Eu2.1: get_key(): how know when RELEASED
- Posted by irv <irv at ELLIJAY.COM> Aug 26, 2000
- 452 views
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
3. Re: Eu2.1: get_key(): how know when RELEASED
- Posted by "Hawke'" <mikedeland at NETZERO.NET> Aug 26, 2000
- 444 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 ___________________________________________________________
4. Re: Eu2.1: get_key(): how know when RELEASED
- Posted by Dan B Moyer <DANMOYER at PRODIGY.NET> Aug 26, 2000
- 464 views
Irv, Hawke, Thanks, but although I haven't yet tried it, I think I found a solution to my problem, & it's real simple if it works: since my intention was to have get_key() set a variable one way or another depending on whether a particular key was pressed or not (including "not pressed" because it had been *released*), (and I didn't really *ask* my question in that form, like I should have!), it would seem that all I have to do is use the simple idea of...INITIAL CONDITION to set my responding variable to what I want it to be *if the key ISN'T pressed*, and then let it get changed by get_key if it IS pressed. That should do it just fine. Sigh. Dan -------------------------------------------------------------------- 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? ---------------------------------------------------------------------------- <and Irv wrote:> >>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. Yes, that did *finally* dawn on me after I saw how similar the quantity of returned -1's were when key was held down! >>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 ? I considered that, with horror, but hopefully the "set initial condition" solution will suffice; thanks! >>Irv ---------------------------------------------------------------------------- --- <and Hawke wrote:> >> 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' Hawke, I'm going to remember this, 'cause it might come in handy another time! Thanks. Dan
5. Re: Eu2.1: get_key(): how know when RELEASED
- Posted by Kat <gertie at PELL.NET> Aug 26, 2000
- 466 views
- Last edited Aug 27, 2000
On 26 Aug 2000, at 16:17, Hawke' wrote: > from keyread.e in the archive: No match found. Try again For those who couldn't find it, search for "keyread" without the ".e", or goto: http://members.aol.com/jcmiura/eu/keyread.zip Kat
6. Re: Eu2.1: get_key(): how know when RELEASED
- Posted by Dan B Moyer <DANMOYER at PRODIGY.NET> Aug 27, 2000
- 463 views
Thanks Kat, and Hawke, I may have to use this, as my simplistic approach worked, but not entirely satisfactorily. Now: does anyone have a short example of it's use handy? Dan (who loves examples) ----- Original Message ----- From: "Kat" <gertie at PELL.NET> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Saturday, August 26, 2000 8:05 PM Subject: Re: Eu2.1: get_key(): how know when RELEASED > On 26 Aug 2000, at 16:17, Hawke' wrote: > > > from keyread.e in the archive: > > No match found. Try again > For those who couldn't find it, search for "keyread" without the ".e", or goto: > > http://members.aol.com/jcmiura/eu/keyread.zip > > Kat