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.