Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ruhi

macrumors member
Original poster
Jun 17, 2009
70
0
Hello All,

I have registered a hot key using:

RegisterEventHotKey(49,cmdKey + shiftKey , myHotKeyID, GetApplicationEventTarget(), 0, &myHotKeyRef);

here the modifiers are written as cmdKey + shiftKey.

Now i have taken my NSTextField subclass which is trapping hotkey pressed on it. Now i want to register this new hot key.

But problem is that i have the new hot key as nsstring like @"cmd shift R"

How can i give this combination in:

RegisterEventHotKey(49,cmdKey + shiftKey , myHotKeyID, GetApplicationEventTarget(), 0, &myHotKeyRef);

as the type is UInt32. Do i have to look for each and every combination possible? Is there any other way to save hotkey or register hotkey ??
:confused::(


Thanks,
Ruhi.
 
Is this for a Carbon app? If not, I'd suggest going about it another way since Carbon is practically obsolete and shouldn't be used for new development. This is one way to do it in Cocoa, although that's an old post.
 
Well I was thinking that sendEvent: would work, but this doesn't get called for keys when your app isn't the frontmost, so I don't think there is a good way to do this outside of Carbon events. You could try this for a better explanation of how to do hotkeys with Carbon in Cocoa.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.