NSTokenField is a subclass of NSTextField that provides tokenized editing similar to the address field in the Mail application. NSTokenField uses an NSTokenFieldCell to implement much of the control’s functionality. NSTokenField provides cover methods for most methods of NSTokenFieldCell, which invoke the corresponding cell method.
Questions tagged [nstokenfield]
84 questions
16
votes
2 answers
NSTokenField with mixed token/string input, possible?
When entering an invalid email in Mail's NSTokenField one get's this (a mix of token and plain string values):
Is there any recommendable way to accomplish this?
Is NSTokenField even the right tool for this? Or would I be abusing it?
In this…

Regexident
- 29,441
- 10
- 93
- 100
10
votes
1 answer
Make NSSearchField use NSTokenFieldCell?
I'm trying to emulate the tokenized search feature of Mail.app and Finder.app on 10.7+ where there is what looks to be an NSSearchField with a search magnifying glass icon on the left and cancel (x) button on the right, but also includes tokens…

Andrew
- 7,630
- 3
- 42
- 51
9
votes
3 answers
How to validate all tokens are valid in an NSTokenField
Apple have conveniently created a callback method that allows you to check that the new tokens that are being added to an NSTokenField are valid:
- (NSArray *)tokenField:(NSTokenField *)tokenField shouldAddObjects:(NSArray *)newTokens…

Jay
- 19,649
- 38
- 121
- 184
8
votes
1 answer
Clicking token in NSTokenField
Is it possible to get an event when you click on a token in a NSTokenField?

Tom Nys
- 579
- 6
- 13
7
votes
3 answers
NSTokenField does not check token on blur
I have an NSTokenField which allows the user to select contacts (Just like in Mail.app). So the NSTextField is bound to an array in my model.recipient instance variable.
The user can now select an entry from the auto completion list e.g. Joe…

Besi
- 22,579
- 24
- 131
- 223
7
votes
0 answers
NSTokenField crashes when editing tokens
I'm using NSTokenField and a corresponding NSTokenFieldDelegate to treat all text that is surrounded by dash characters - as rounded tokens and all other text as plain text.
The rounded tokens are displayed without the surrounding dashes and upon…

fhe
- 6,099
- 1
- 41
- 44
7
votes
1 answer
Get mouse clicks on NSTokenField
I would like to implement a NSTokenField that will show Tokens that - when hovering over the token - show a removal icon. Subsequently when I click on the icon I want the token to be removed.
After a lot of searching it seems that this is not…

Fred Appelman
- 716
- 5
- 13
7
votes
1 answer
Token text field like in Numbers
I'd like to have a text field like the expression editor text field in Numbers:
It's very similar to NSTokenField, but NSTokenField only supports a delimiter separated list of tokens, like the "To:" field in Mail.app.
I have to embed these tokens…

DrummerB
- 39,814
- 12
- 105
- 142
6
votes
3 answers
NSTokenField representing Core Data to-many relationship
I'm having a problem figuring out how to represent a many-to-many relationship model in a NSTokenField. I have two (relevant) models:
Item
Tag
An item can have many tags and a tag can have many items. So it's an inverse to-many relationship.
What I…

simonwh
- 1,017
- 8
- 21
6
votes
2 answers
how to customize NSTokenField like in "To/ CC" fields in mac mail?
I am able to work with NSTokenField, it is easy to use.. but I want your suggestions on how can I customize it just like it is in "To/ CC" fields in mac mail ie. when no. of tokens in a token field increases height of "To" field gets increased to a…

Devarshi
- 16,440
- 13
- 72
- 125
6
votes
1 answer
Mavericks Style Tagging
I'm quite new to cocoa and I'm trying to find out how I can create something similar to the new tagging UI in Mavericks:
I assume, I'll have to overwrite NSTokenFieldCell to get the coloured dots or an icon on the tags. But how does this popup list…

Zap
- 859
- 1
- 7
- 10
5
votes
2 answers
flexible alternative to NSTokenField?
I am trying to customize an NSTokenField and after trying several hours I realized that NSTokenField is not customizable enough (at least using public methods).
Do you know an alternative to NSTokenField which can be easily customized?
Thanks!

AP.
- 5,205
- 7
- 50
- 94
5
votes
2 answers
NSTokenField Suggest but don't complete
I feel like this must be a common issue that I'm just struggling to figure out, but I couldn't find anyone else who asked the question so...
Basically I have an NSTokenField and when the user begins typing I make a SOAP request and get names that…

Phil
- 521
- 1
- 5
- 14
5
votes
1 answer
Mixing tokens and strings in NSTokenField
I want to have an NSTokenField that contains both plain text and tokens. That's the same problem as in this question, but the answers there haven't solved it for me. Maybe I'm missing something, or maybe Apple changed something in the 5 years…

JWWalker
- 22,385
- 6
- 55
- 76
5
votes
1 answer
Multiline NSTokenField display error
I insert a NSTokenField into a NSView, when input has enough tokens, it turn into multiline mode, but there there is a problem with it. The top of first line gets cut off 2px and the line spacing between two line becomes too small.
Is there a way…

Ron
- 89
- 7