On Wed, Jan 25, 2012 at 1:24 PM, Ken Thomases <[email protected]> wrote:
> On Jan 24, 2012, at 1:30 AM, Akhil Jindal wrote: > > > I am developing a desktop application on cocoa and am trying to handle > the > > menu keyboard shortcuts on my own. > > That's weird. Why? Maybe your reasons for doing so are based on faulty > assumptions or what you're _really_ trying to accomplish -- since I very > much doubt that handling menu keyboard shortcuts is a first-order interest > of yours -- can be done a different way that doesn't require this. > > > Well, I would very much like it if I could let the OS handle it. The problem is that I have some keyboard shortcuts associated with hidden menus. Cocoa doesn't seem to be able to handle that! > > OSStatus status = UCKeyTranslate(keyboardLayout, inScanCode, > > kUCKeyActionDown, inModifiers, LMGetKbdType(), > > kUCKeyTranslateNoDeadKeysBit, &deadKeyState, maxStrLen, &actualLength, > > strBuff); > > > This works fine for English language but when I use an IME, say for > example > > Cangjie, Zhuyin,etc things start to mess up. I have for eg a keyboard > > shortcut of Cmd+N for opening a new file. But on pressing 'N' on these > > IME's I get a japanese/chinese character which obviously doesn't match up > > with 'N' and hence the shortcut doesn't work. > > What are you passing in for the modifiers? I would expect that passing in > cmdKeyBit would result in UCKeyTranslate returning latin characters. > I'm not passing in any modifiers. I've initialised inModifiers as 0. I tried passing in cmdKeyBit as the modifier but with that UCKeyTranslate() is returning actualLength as 0 on pressing Cmd+N on US IME itself. > Regards, > Ken > > _______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
