Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Example of intercepting keystroke events?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Example of intercepting keystroke events?



I am writing a small "console" application that is generally outputting data [via printf()]. I would like the user to be able to enter text but I don't want the current output messed up - I am currently using getchar() in a separate thread but have found that this echos the typed character (and, in fact, it doesn't exit until a CR [so it operated more like gets()]).

I am assuming that my solution is to intercept keystroke events from the RunLoop. I have studied the documentation but could do with an example of how to do this. Could someone point me to a working example?

I have this working on a windoze platform; they have a _kbhit() function that I use, but I have also handled Windows messages to do this.

Many thanks,  email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Usb mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.