Re: Setting key equivalent to arrow key?
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.