Board index » delphi » Help requested: keyboard input..

Help requested: keyboard input..

I wrote a unit to input directly from the keyboard on the PC and track
key up/down states, and overall it works okay.  However, when certain
key combinations are pressed, one or more of the keys won't be detected.
For example, if the Up arrow, PgUp, and the Right arrow are held down
simultaneously, the first two pressed will be detected but the third
won't: if I press Up, PgUp, Right, Up and PgUp will be detected but
not Right.  As far as I can tell, the keyboard isn't even sending the
Make codes for the third key.  Does anyone have any ideas or information
to point me to?  Thanks!

          Daniel Burrows

 

Re:Help requested: keyboard input..


Quote
Daniel Burrows wrote:
> I wrote a unit to input directly from the keyboard on the PC and track
> key up/down states, and overall it works okay.  However, when certain
> key combinations are pressed, one or more of the keys won't be detected.
> For example, if the Up arrow, PgUp, and the Right arrow are held down
> simultaneously, the first two pressed will be detected but the third
> won't: if I press Up, PgUp, Right, Up and PgUp will be detected but
> not Right.  As far as I can tell, the keyboard isn't even sending the
> Make codes for the third key.  Does anyone have any ideas or information
> to point me to?

This phenomenon is know as "key collision" and, as far as I know, there
is not much that can be done about except: don't expect those keys to be
used simultaneously in your program. Frustratingly, all keyboards seem
to behave differently as far as which keys don't like to be pressed
together, with no apparent predictable pattern.

AME

Re:Help requested: keyboard input..


Quote
Alan M. Evans wrote:

> Daniel Burrows wrote:

> > I wrote a unit to input directly from the keyboard on the PC and track
> > key up/down states, and overall it works okay.  However, when certain
> > key combinations are pressed, one or more of the keys won't be detected.
> > For example, if the Up arrow, PgUp, and the Right arrow are held down
> > simultaneously, the first two pressed will be detected but the third
> > won't: if I press Up, PgUp, Right, Up and PgUp will be detected but
> > not Right.  As far as I can tell, the keyboard isn't even sending the
> > Make codes for the third key.  Does anyone have any ideas or information
> > to point me to?

> This phenomenon is know as "key collision" and, as far as I know, there
> is not much that can be done about except: don't expect those keys to be
> used simultaneously in your program. Frustratingly, all keyboards seem
> to behave differently as far as which keys don't like to be pressed
> together, with no apparent predictable pattern.

> AME

  Thanks!  I'm glad you pointed this out; I was suspecting something
like that was happening, but I wasn't sure it wasn't a problem in my
code..

    Daniel Burrows

Re:Help requested: keyboard input..


In article <32D54A3F.2...@shadow.astro.psu.edu>, Daniel Burrows <dan...@shadow.astro.psu.edu> says:

Quote

>I wrote a unit to input directly from the keyboard on the PC and track
>key up/down states, and overall it works okay.  However, when certain
>key combinations are pressed, one or more of the keys won't be detected.
>For example, if the Up arrow, PgUp, and the Right arrow are held down
>simultaneously, the first two pressed will be detected but the third
>won't: if I press Up, PgUp, Right, Up and PgUp will be detected but
>not Right.  As far as I can tell, the keyboard isn't even sending the
>Make codes for the third key.  Does anyone have any ideas or information
>to point me to?  Thanks!

>          Daniel Burrows

Hmmm... I don't know how you did it, but you could check out the source
code of my keyboard unit on my homepage. I haven't experienced problems
with it yet.
My homepage: http://www.cpedu.rug.nl/~N0958697
Bye!

Re:Help requested: keyboard input..


Quote
<Unknown> (Wouter Soer) wrote:
>In article <32D54A3F.2...@shadow.astro.psu.edu>, Daniel Burrows <dan...@shadow.astro.psu.edu> says:
>>I wrote a unit to input directly from the keyboard on the PC and track
>>key up/down states, and overall it works okay.  However, when certain
>>key combinations are pressed, one or more of the keys won't be detected.
>>For example, if the Up arrow, PgUp, and the Right arrow are held down
>>simultaneously, the first two pressed will be detected but the third
>>won't: if I press Up, PgUp, Right, Up and PgUp will be detected but
>>not Right.  As far as I can tell, the keyboard isn't even sending the
>>Make codes for the third key.  Does anyone have any ideas or information
>>to point me to?  Thanks!
>>          Daniel Burrows

This is known as key collision. Different keys collide on different
keyboards. This is a hardware limitation and happens with my keyboard unit
as well. There are no real solutions other than to avoid requiring that
the user press more than two or three keys at once.

Good luck!

Re:Help requested: keyboard input..


Quote
Reeves Hall (Hall-in-B...@worldnet.att.net) wrote:

: <Unknown> (Wouter Soer) wrote:
: >In article <32D54A3F.2...@shadow.astro.psu.edu>, Daniel Burrows <dan...@shadow.astro.psu.edu> says:
: >>I wrote a unit to input directly from the keyboard on the PC and track
: >>key up/down states, and overall it works okay.  However, when certain
: >>key combinations are pressed, one or more of the keys won't be detected.
: >>For example, if the Up arrow, PgUp, and the Right arrow are held down
: >>simultaneously, the first two pressed will be detected but the third
: >>won't: if I press Up, PgUp, Right, Up and PgUp will be detected but
: >>not Right.  As far as I can tell, the keyboard isn't even sending the
: >>Make codes for the third key.  Does anyone have any ideas or information
: >>to point me to?  Thanks!
: >>          Daniel Burrows
:
: This is known as key collision. Different keys collide on different
: keyboards. This is a hardware limitation and happens with my keyboard unit
: as well. There are no real solutions other than to avoid requiring that
: the user press more than two or three keys at once.
:
: Good luck!
:
:
Is this right?  I've seen several games which can process multiple keys at
once - not just alt and something else.

squigger hops again

Re:Help requested: keyboard input..


Quote
(Wouter Soer) wrote:

> In article <32D54A3F.2...@shadow.astro.psu.edu>, Daniel Burrows <dan...@shadow.astro.psu.edu> says:

> >I wrote a unit to input directly from the keyboard on the PC and track
> >key up/down states, and overall it works okay.  However, when certain
> >key combinations are pressed, one or more of the keys won't be detected.
> >For example, if the Up arrow, PgUp, and the Right arrow are held down
> >simultaneously, the first two pressed will be detected but the third
> >won't: if I press Up, PgUp, Right, Up and PgUp will be detected but
> >not Right.  As far as I can tell, the keyboard isn't even sending the
> >Make codes for the third key.  Does anyone have any ideas or information
> >to point me to?  Thanks!

Seems perfectly normal to me. Its something to do with those keys being
extended keys. I'd guess you get the same effect if you press any more
than four character keys. ie the fifth key doesn't register.

This is a result of the way pc keyboards work.

Regards, Jason.
---------------- Jason McCallion ----------------
                jpm...@york.ac.uk
-------------------------------------------------
           http://www.spideractive.com/
              The Secession Project
     ...download a fully playable demo now...

Other Threads