NSTextfields and keyboard equivalents - am I missing something?
NSTextfields and keyboard equivalents - am I missing something?
- Subject: NSTextfields and keyboard equivalents - am I missing something?
- From: "Mattias Arrelid" <email@hidden>
- Date: Mon, 21 Apr 2008 18:27:13 +0200
I have a simple test application with a few custom menu items. Let's
assume that _none_ of these items has a key equivalent of COMMAND +
(right arrow) for now.
When the first responder of the application is an NSTextField, and the
user produces COMMAND + (right arrow), the insertion point is being
placed right after the last character in the text field. This is true
as long as the text field stays the first responder. As mentioned
earler, I _don't_ have a menu item with such a key equivalent at this
point.
If I add a menu item that _has_ a key equivalent of COMMAND + (righ
arrow), what happens is that this item's action is performed when I
press the above key combo - even if the text field is the first
responder. Is this supposed to happen? When reading the Cocoa
Event-Handling documentation, I stumbled upon this:
http://developer.apple.com/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/chapter_2_section_3.html#//apple_ref/doc/uid/10000060i-CH3-SW10
Inspired by that, I enabled some breakpoints in my project. From
these, I can see that the text field doesn't seem to care about saying
"yes, I do respond to COMMAND + (right arrow)" when its
"performKeyEquivalent:" is called, which explains why the menu item
gets the action eventually. Is this correct?
To sum things up: I want the text field to respond to all "standard"
key equivalents (move cursor to front, end, move word forward/backward
etc.), even if I have a menu item with such a key equivalent. There
are applications that behave like this, e.g. iTunes, and I do think
that this is the correct behavior. Could anyone point me in the right
direction here?
Regards
Mattias
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden