Re: From NSTextView to address an NSTextField
Re: From NSTextView to address an NSTextField
- Subject: Re: From NSTextView to address an NSTextField
- From: Alastair Houghton <email@hidden>
- Date: Mon, 3 Aug 2009 09:43:42 +0100
On 2 Aug 2009, at 21:48, Steve Cronin wrote:
Folks;
NSTextView <- NSText <- NSView <- NSReponder <- NSObject
NSTextField <- NSView <- NSReponder <- NSObject
At runtime if I have access to an instance of NSTextView how can I
address the NSTextField?
I know I should know this but I having a 'moment'...
In addition to what Kyle said, the confusion probably arises because
NSTextField uses the field editor, so it is possible to receive
notifications relating to the field editor in which case you might not
know which text field it was about.
Usually this means you're watching the wrong notification. The
inheritance diagram for NSTextField above is wrong; it should look
like this:
NSTextField <- NSControl <- NSView <- NSResponder <- NSObject
and the important part here is NSControl. NSControl sends a number of
notifications that mirror those sent by NSText(View), and if you're
finding that you're getting a notification that doesn't tell you which
NSTextField (or other editable control) you're dealing with, it's
probably just that you're somehow listening to the NSText(View)
notifications rather than the NSControl ones.
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
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