Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Capturing the Keyboard Buffer
Message
De
21/10/1999 11:40:18
 
 
À
19/10/1999 16:30:04
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00277736
Message ID:
00279379
Vues:
20
>>>>>>>>Does anyone know of a means of capturing the contents of the keyboard buffer? Having searched the Thread, I see this question has been asked several times, but never answered directly. I do not have a situation where I can look to Inkey() or the keypress method to capture a keypress, I need to examine the keyboard buffer's contents.
>>>>>>>>
>>>>>>>>Any help would be appreciated.
>>>>>>>>
>>>>>>>>Regards,
>>>>>>>
>>>>>>>What exactly are you trying to do?
>>>>>>
>>>>>>Hi Erik,
>>>>>>
>>>>>>Trying the capture the contents of the keyboard buffer into a variable so I can see what's there.
>>>>>>
>>>>>>regards,
>>>>>
>>>>>I got that part. Why?
>>>>
>>>>I want to see if the same key has been pressed repeatedly so I can respons appropriately to the repeated keypress.
>>>
>>>Ahh, I see. I don't think that there's a system variable or anything like that that holds the keyboard buffer contents, but you can use INKEY() in a loop to capture more than one keystroke... does that do you any good?
>>
>>Hi Erik,
>>
>>Yes, we know all about inkey(), but it does not solve the problem. My fault for not explaining more fully.
>>
>>We have a process which may be executed repetitively merely by holding down the appropriate "hot key". However, it takes 180 mseconds to execute, so if the user just holds the key down, we want to jump over a few iterations rathen than process them all. For example rather than process 5 iterations of the process if the hotkey is held down, we want to count the number of times it appears in the buffer then jump to the 5th iteration and process that. This sort of similates multi-thread processing.
>>
>>The issue is how to capture the number of time the key appears in the buffer.
>>
>>I hope this is clearer.
>
>Right. But you should still be able to use INKEY() to do this:
>
>lnInkey = INKEY()
>IF lnInkey <> 0
> lnCharactersInBuffer = 1
> DO WHILE lnINkey <> 0
> lnCharactersInBuffer = lnCharactersInBuffer + 1
> lnInkey = INKEY()
> ENDDO
>ENDIF
>
>?lnCharactersInBuffer

Erik:

Actually your idea was very close to what eventually worked.

After reading your response I finally had one of those "Ahaa" experiences when I realized a control's keypress() event handler and inkey() work the same way -- they both extract the next unhandled keypress from the keyboard buffer.

After that insight, it was easy to construct a process to extract the keypresses with inkey() and pass the ones I did not want to process with special handling back to keypress() for default handling.

Thanks for the steer in the right direction.

Regards,
Jim Edgar
Jurix Data Corporation
jmedgar@yahoo.com

No trees were destroyed in sending this message. However, a large number of electrons were diverted from their ordinary activities and terribly inconvenienced.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform