• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Programmatically inserting text in an NSTokenField [Workaround]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: [NSTableView] How should a column be resized when...
  • Next by Date: DVD as desktop
  • Previous by thread: [NSTableView] How should a column be resized when...
  • Next by thread: DVD as desktop
  • Index(es):
    • Date
    • Thread