PDA

View Full Version : New Tutorial on Global Hotkeys




iBonzo
Nov 28, 2005, 07:45 PM
I wrote a tutorial on how to use Global Hotkeys in Cocoa. After much trouble finding documentation on this area of Cocoa, I wrote this tutorial to explain it simply.

Link: http://www.dbachrach.com/blog/2005/11/program-global-hotkeys-in-cocoa-easily.html

Hope it helps ya'll.

-Dustin



whooleytoo
Nov 29, 2005, 01:59 PM
I wrote a tutorial on how to use Global Hotkeys in Cocoa. After much trouble finding documentation on this area of Cocoa, I wrote this tutorial to explain it simply.

Link: http://www.dbachrach.com/blog/2005/11/program-global-hotkeys-in-cocoa-easily.html

Hope it helps ya'll.

-Dustin

Haven't tried it yet, but looks very interesting. Thanks for the tutorial!

HiRez
Nov 29, 2005, 05:16 PM
I wrote a tutorial on how to use Global Hotkeys in Cocoa.Very cool, thanks a lot iBonzo! I don't have a need for this now, but I probably will someday.

Now, I have a somewhat related question for you all. I'm trying to have it so that I have hotkeys specific to a document window. For example, the space bar would toggle a pause/play method (independant for each document window). OK, so I have subclassed NSWindow and overridden keyDown: and that works fine. However, the problem is that I have editable text fields on this window, and as soon as I begin to edit one of the text fields, I lose my "window hotkeys" because it's stuck editing the text field. The text field will not resign editing (or focus, responder) status when I'm done editing (with return key). So how can I tell my app, or that document window at least, to end all editing and "defocus" all UI objects? I found a few methods that looked like they might do that, but they didn't work as advertised. Do I have to do something painful like subclass every editable UI object to accomplish this?

iBonzo
Nov 29, 2005, 05:36 PM
I have not experimented with this, but as I was browsing through the docs, I think I came accross something that might work. I've just pulled it up right now in XCode and it looks like it might work. Open up your XCode and look at the Developer Documentation under Help. Do a search for "InstallEventHandler". This should bring up a page with explinations. Scroll down a little bit and read the Disccusion part. There is mention of InstallWindowEventHandler. Seems like it would be very similar to the turoial I wrote but just using a different function (InstallWindowEventHandler instead of InstallApplicationEventHandler) but do look into that function a little more to make sure.

Hope this helps,

-Dustin

HiRez
Nov 30, 2005, 03:13 AM
Hope this helpsThanks, I will have a look at that.