• 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: Setting key equivalent to arrow key?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting key equivalent to arrow key?


  • Subject: Re: Setting key equivalent to arrow key?
  • From: Darrin Cardani <email@hidden>
  • Date: Mon, 8 Mar 2004 15:43:21 -0600

At 3:39 PM -0600 3/8/04, Darrin Cardani wrote:
I have an NSButton, and I want to set its key equivalent to option left arrow. However, [ NSButton setKeyEquivalent: ] takes a string. I tried putting the UniCode left arrow character (0x2190) into a string and using that, but it didn't work. I also tried putting character 123 into a string, as that's the keyCode that [ NSEvent keyCode ] returns when the left arrow is pressed. However, that also did not work. So then I tried putting UniCode character 0xF702 into a string, since that's the character returned by [ NSEvent characters ] when the left arrow key is pressed, and that also did not work. Is there any way to do what I want?

D'oh! Never mind! It turns out I was creating the string like this:

UniChar leftArrow = 0xF702;
NSString* leftArrowStr = [ NSString stringWithCharacters:&leftArrow length:2 ];

I was thinking 2 bytes, but I was actually telling it 2 characters. Changing the length to 1 character caused it to work.

Darrin
--
Darrin Cardani - email@hidden
President, Buena Software, Inc.
<http://www.buena.com/>
Video, Image and Audio Processing Development
_______________________________________________
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: [OT] Apple Developer Certification
  • Next by Date: Re: Using NSView as a template
  • Previous by thread: Setting key equivalent to arrow key?
  • Next by thread: Cocoa API for System Status?
  • Index(es):
    • Date
    • Thread