Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Programmatically inserting text in an NSTokenField [Workaround]



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.