Re: keyUp falling through to window when sheet dismissed
Re: keyUp falling through to window when sheet dismissed
- Subject: Re: keyUp falling through to window when sheet dismissed
- From: Ken Worley <email@hidden>
- Date: Tue, 21 Oct 2008 17:29:32 -0600
On Oct 21, 2008, at 4:17 PM, Ken Worley wrote:
On Oct 21, 2008, at 4:03 PM, Kyle Sluder wrote:
On Tue, Oct 21, 2008 at 5:35 PM, Ken Worley
<email@hidden> wrote:
This, by the way, is a constant source of confusion for me in
Cocoa. Why is
a delegate method specific to NSTextView listed under NSControl
which is the
parent class?
You seem to be misunderstanding a bit. The field editor is an
instance of NSTextView (or a subclass). Any control, however, may
make use of the field editor, not just NSTextField. More information
about the relationship between text views, the field editor, and
controls can be found in the Text System Overview:
http://developer.apple.com/documentation/Cocoa/Conceptual/TextArchitecture/Concepts/TextFieldsAndViews.html
--Kyle Sluder
You're right. I was somewhat confused. After looking at this in more
detail, it seemed to me that the correct thing to do would be to
specify a delegate to the NSTextField control and implement the -
control:textView:doCommandBySelector: method that you suggested.
When I do that, however, the method never gets called, so I'm still
not quite getting things. Still assimilating info though.
In the end, I found this note in the documentation for the
textDidEndEditing: method of NSTextField:
If the user ended editing by pressing Return, this method tries to
send the receiver’s action to its target; if unsuccessful, it sends
performKeyEquivalent: to its NSView (for example, to handle the
default button on a panel); if that also fails, the receiver simply
selects its text.
I set an action and target for the NSTextField and it's called when
the user presses Return or Enter. That's exactly what I needed in this
case. I never did get anything working using
control:textView:doCommandBySelector, but I'm not sure if I was using
it correctly.
Thanks,
Ken
--
Ken Worley
Software Engineer, Tiberius, Inc.
_______________________________________________
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