Re: Programmatically inserting text in an NSTokenField [Workaround]
Re: Programmatically inserting text in an NSTokenField [Workaround]
- Subject: Re: Programmatically inserting text in an NSTokenField [Workaround]
- From: "Glen Simmons" <email@hidden>
- Date: Tue, 20 Mar 2007 11:08:47 -0500
On 3/19/07, Glen Simmons <email@hidden> wrote:
This seems like it should be simple, but I'm stumped. I need to be
able to programmatically insert text in an NSTokenField at the
insertion point. The problem is, I don't see any way of finding out
where it is. NSTokenField and its ancestors are no help. I played
with getting the field editor, but it doesn't seem to know anything
about the contents of the NSTokenField. Help?
More info: NSTokenField uses a private class for its field editor.
There appears to be no direct way to get at this object, including
through -[NSWindow fieldEditor:forObject:] (Bad Apple! No donut!).
However, it does get passed in the -[NSControl
control:textShouldBeginEditing:] delegate message, so I'm caching it
here as a workaround. Messages to that object, including
-selectedRange and -insertText: work as expected.
HTH,
Glen
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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