Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
[cocoa keyboardInput]
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Three" data-source="post: 406711" data-attributes="member: 23165"><p>Not to bump the post but:</p><p>Just in case anyone is interested. I have found one way. You can load the StandardKeyBinding.dict dictionary file and check the key-value using the return from [anEvent characters] as the key.</p><p></p><p>[code]</p><p>- (void)keyDown:(NSEvent *)anEvent</p><p>{</p><p> if ([anEvent modifierFlags] & NSFunctionKeyMask) {</p><p> if ([[keyBindings objectForKey:[anEvent characters]] isEqual:@"moveLeft:"]) {</p><p> NSLog(@"leftArrow"); </p><p> }</p><p> if ([[keyBindings objectForKey:[anEvent characters]] isEqual:@"moveRight:"]) {</p><p> NSLog(@"rightArrow");</p><p> }</p><p> if ([[keyBindings objectForKey:[anEvent characters]] isEqual:@"moveDown:"]) {</p><p> NSLog(@"downArrow");</p><p> }</p><p> if ([[keyBindings objectForKey:[anEvent characters]] isEqual:@"moveUp:"]) {</p><p> NSLog(@"upArrow");</p><p> }</p><p> }</p><p>}</p><p>[/code]</p><p></p><p>If anyone knows a better way, for that matter any other way, please let me know.</p></blockquote><p></p>
[QUOTE="Three, post: 406711, member: 23165"] Not to bump the post but: Just in case anyone is interested. I have found one way. You can load the StandardKeyBinding.dict dictionary file and check the key-value using the return from [anEvent characters] as the key. [code] - (void)keyDown:(NSEvent *)anEvent { if ([anEvent modifierFlags] & NSFunctionKeyMask) { if ([[keyBindings objectForKey:[anEvent characters]] isEqual:@"moveLeft:"]) { NSLog(@"leftArrow"); } if ([[keyBindings objectForKey:[anEvent characters]] isEqual:@"moveRight:"]) { NSLog(@"rightArrow"); } if ([[keyBindings objectForKey:[anEvent characters]] isEqual:@"moveDown:"]) { NSLog(@"downArrow"); } if ([[keyBindings objectForKey:[anEvent characters]] isEqual:@"moveUp:"]) { NSLog(@"upArrow"); } } } [/code] If anyone knows a better way, for that matter any other way, please let me know. [/QUOTE]
Verification
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
[cocoa keyboardInput]
Top