• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: cocoa-dev digest, Vol 2 #2027 - 17 msgs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cocoa-dev digest, Vol 2 #2027 - 17 msgs


  • Subject: Re: cocoa-dev digest, Vol 2 #2027 - 17 msgs
  • From: Ian Gillespie <email@hidden>
  • Date: Fri, 7 Mar 2003 07:59:36 -0800

I am looking for a similar solution. I have successfully used Carbon
in my Cocoa app to register "hot keys" with a key modifier. I
registered Shift and most of the letter keys so that I get all capital
letters that the user presses regardless of the active application. My
problem is that I can't let those key events continue on to the
appropriate application. In my Carbon methods I have tried returning
eventNotHandledErr but this seems to send my app into an infinite
recursion and crashes.


>> Oops -- this went to the Carbon people by mistake.
>>
>> Is there a way in Cocoa (okay, or Carbon) to get every keystroke,
>> regardless of which application is active? I want to write a
>> background application that intercepts and inspects all keystrokes
>> (looking for certain strings or triggers) and then send most of them
>> on to the active application.
>>
>> It must be easy -- there are several applications that do this,
>> saving the keystrokes to a file.
>>
>> Jeff
>>
>
> Umm, it's not that easy, and the article at
>
> http://www.obdev.at/developers/articles/00001.html
>
> describes one of the MOST "not easy" ways to do this (forgive the
> rotten
> English, but you get the drift).
>
> If you do a little testing with most (if not all) of the apps that can
> intercept keystrokes and save them to a file you'll see that they
> either:
>
> - chew up a whole lot of CPU while polling for changes in the
> keyboard's
> state, or
> - simply (and easily) miss keystrokes completely if you type quickly.
>
> There is (currently) only one Apple-supported/sanctioned way of doing
> this
> (with any sort of accuracy and reliability) on OS X: via an Input
> Method
> (see Apple's BasicInputMethod sample).
>
> It's not easy to write one of these either, but at least it's
> supported and
> (mostly, even if a bit scattered) documented.
>
> If you don't mind missing some keystrokes and/or polling (your users
> may
> mind the polling!) then there are other techniques that might be good
> enough
> for your purposes.
>
> If you're looking to somehow alter the user's keystrokes before they
> actually make their way into the active application, then you're
> probably
> best off writing an Input Method. In fact, that's the main reason for
> their
> existence...
>
> Hope that helps,
>
> Evan Gross
> Rainmaker Research Inc.
>
> (Developer of Spell Catcher X, a mostly Cocoa app that uses an Input
> Method
> for as-you-type features - see www.casadyg.com for more info).
>
> --__--__--
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: displaying a sheet without having the icon bouncing
  • Next by Date: Re: NSFileManager fileAttributesAtPath confusion
  • Previous by thread: nibtool can't find my image
  • Next by thread: Re: NSTableView scrollbar not updating
  • Index(es):
    • Date
    • Thread