Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passive Keyboard Input

Status
Not open for further replies.

infinitysquadron

Programmer
Aug 2, 2002
20
CA
Yo, it's me again,

I need a form of taking input from the keyboard, mainly the arrow keys and space bar, that does not inturrupt the program's execution. Basically, the user needs to select something from a menu (using the arrow keys) while other events are happening. I was hoping for a way for the program to 'check' if the user had pressed any keys every few milliseconds, and if not, go about doing the other routines.

I've looked at a few options, but not of which have worked. KeyListeners don't take effect until my program's execution has ended, making it come in a little too late... And the other basic forms of input halt the program in it's traks as well as requiring the enter key to be pressed and other annoying things like that. In QBASIC we used the INKEY$ variable, which held the value of the last key pressed on the keyboard.

Does anyone know a good way of doing this?
 
have you tried creating a separate thread to listen for the keys? StevoIE
 
No... I thought that since my key listeners were never called until the end of the program's execution, I didn't think it'd have anything do do with what the thread was doing. I'll try it I guess.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top