Article View: comp.sys.amiga.tech
Article #13997Re: Reading the keyboard without a window.
From: Bruce Dawson
Date: Thu, 01 Mar 1990 15:33
Date: Thu, 01 Mar 1990 15:33
62 lines
2567 bytes
2567 bytes
>
>
> If you hold down a key it begins to repeat, I want to ignore the messages
> sent to me by the autorepeat after you have lifted your finger from the
> key. How do I do that if they come faster than I can process them ?
>
> If there is a better, more supported way please tell me!
>
>
> >/--------------------------------------------------------------------- -\
> >| /// Michael Sinz -- CATS/Amiga Software Engineer |
> >| /// PHONE 215-431-9422 UUCP ( uunet | rutgers ) !cbmvax!mks |
> >| /// |
> >|\\\/// When people are free to do as they please, |
> >| \XX/ they usually imitate each other. |
> >\-------------------------------------------------------------------- --/
>
> Asaph.
> asaph@taurus.bitnet asaph@math.tau.ac.il
Using the keymatrix function sounds like a valid way of dealing with
auto-repeat, and dealing with auto-repeat to avoid run on is certainly a valid
thing to do (understatement of the year, I HATE programs that don't properly
deal with auto-repeat).
However, I happen to use a different method. Psuedo code is:
; if (AuxValid) /* If a previous message is cached */
; Copy AuxMessageBuffer to MessageBuffer
; else
; if GetMsg()
; {
; Copy message to MessageBuffer
; Reply to message.
; }
; else
; Exit(FALSE);
; AuxValid = FALSE.
; /* now deal with auto-repeat. */
; StillAutoRepeating:;
; while (GetMsg)
; {
; Copy message to AuxMessageBuffer
; if (AuxMessageBuffer.Qualifier & IEQUALIFIER_REPEAT)
; goto StillAutoRepeating;
; else
; {
; AuxValid = TRUE;
; Exit(TRUE);
; }
; }
; Exit(TRUE);
;
; If this routine returns true, look for a message in MessageBuffer.
Basically, after getting a message, keep reading message until you run out
of messages or until you read in a message that doesn't have the auto-repeat
bit set. Cache the last message read so that you can use it next time. It
works.
.Bruce Dawson.
Technical Details
Message-ID:
<1237@mindlink.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!van-bc!rsoft!mindlink!a464Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!van-bc!rsoft!mindlink!a464 From: a464@mindlink.UUCP (Bruce Dawson) Newsgroups: comp.sys.amiga.tech Subject: Re: Reading the keyboard without a window. Message-ID: <1237@mindlink.UUCP> Date: 1 Mar 90 15:33:15 GMT Organization: MIND LINK! - British Columbia, Canada Lines: 62