Would like to use NSFormatter with NSTokenField

Originator:apontious
Number:rdar://9092238 Date Originated:3/5/2011
Status:Closed Resolved:Duplicate/4247907
Product:Mac OS X Product Version:
Classification:Enhancement Reproducible:
 
Summary: It appears to be impossible currently to use an NSFormatter to disallow certain keystrokes with an NSTokenField, due to the way both classes work.

NSTokenField is a subclass of NSTextField, and it formats the contents of the text field in a private way, including the use of attachments to represent the tokens.

NSFormatter, however, requires its subclassers to be able to provide the *exact* text field string contents of the text field it's attached to. Which I can't do, because I can't replicate the private format of the NSTokenField's text.

What I'd like is a subclass of NSFormatter that allows custom subclassers to *not* have to replicate the private innards of an NSTokenField's text, but still allows for custom formatting and validation of the untokenized text in such a field.

Some links to other people who've had these problems:

http://stackoverflow.com/questions/4115407/prevent-newlines-to-be-typed-in-an-nstokenfield

http://lists.apple.com/archives/Cocoa-dev/2008/Jul/msg00233.html

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!