I have an NSTokenField that allows the user to select contacts (exactly the same as in Mail.app). So NSTextField is bound to an array in my instance variable model.recipient .
Now the user can select an entry from the list of automatic completion, for example. Joe Bloggs: joe@blogs.com and as soon as he presses Enter , a token (Joe Bloggs) model.recipients and model.recipients now contains a BBContact entry.
Now, if the user starts to enter some keys (suggestions are displayed this way), and then displays Tab instead of entering a marker with the completion text value (Joe Bloggs: joe@bloggs.com ) , and the NSTokenFieldDelegate methods NSTokenFieldDelegate called so that I can respond to this event. The model.recipient now contains an NSString instead of the BBContact .
Curiously, the tokenField:shouldAddObjects:atIndex: delegate method is not called, which I expect when the user selects a token from the field.

Besi
source share