| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AppKit.framework |
| Availability | Available in Mac OS X v10.4 and later.
|
| Declared in | NSTokenFieldCell.h |
NSTokenFieldCell is a subclass of NSTextFieldCell that provides tokenized editing of an array of objects similar to the address field in Mail.app. The objects may be strings or objects that can be represented as strings.
– tokenFieldCell:displayStringForRepresentedObject: delegate method
– tokenFieldCell:styleForRepresentedObject: delegate method
– tokenFieldCell:editingStringForRepresentedObject: delegate method
– tokenFieldCell:completionsForSubstring:indexOfToken:indexOfSelectedItem: delegate method
– tokenFieldCell:representedObjectForEditingString: delegate method
– tokenFieldCell:shouldAddObjects:atIndex: delegate method
– tokenFieldCell:readFromPasteboard: delegate method
– tokenFieldCell:writeRepresentedObjects:toPasteboard: delegate method
– tokenFieldCell:hasMenuForRepresentedObject: delegate method
– tokenFieldCell:menuForRepresentedObject: delegate method
Returns the default completion delay.
+ (NSTimeInterval)defaultCompletionDelay
The default completion delay.
The default completion delay is 0.
NSTokenFieldCell.h
Returns the default tokenizing character set.
+ (NSCharacterSet *)defaultTokenizingCharacterSet
The default tokenizing character set.
The default tokenizing character set contains the single character “,”.
NSTokenFieldCell.hReturns the receiver’s completion delay.
- (NSTimeInterval)completionDelay
The receiver’s completion delay.
NSTokenFieldCell.hReturns the receiver’s delegate.
- (id)delegate
The receiver’s delegate.
NSTokenFieldCell.hSets the receiver’s completion delay to a given delay.
- (void)setCompletionDelay:(NSTimeInterval)delay
The delay for the receiver.
NSTokenFieldCell.hSets the receiver’s delegate.
- (void)setDelegate:(id)anObject
The delegate for the receiver.
NSTokenFieldCell.hSets the receiver’s tokenizing character set to a given character set.
- (void)setTokenizingCharacterSet:(NSCharacterSet *)characterSet
The tokenizing character set for the receiver.
NSTokenFieldCell.hSets the token style of the receiver.
- (void)setTokenStyle:(NSTokenStyle)style
The token style for the receiver.
NSTokenFieldCell.hReturns the receiver’s tokenizing character set.
- (NSCharacterSet *)tokenizingCharacterSet
The receiver’s tokenizing character set.
NSTokenFieldCell.hReturns the receiver’s token style.
- (NSTokenStyle)tokenStyle
The receiver’s token style.
NSTokenFieldCell.hAllows the delegate to provide an array of appropriate completions for the contents of the receiver.
- (NSArray *)tokenFieldCell:(NSTokenFieldCell *)tokenFieldCell completionsForSubstring:(NSString *)substring indexOfToken:(NSInteger)tokenIndex indexOfSelectedItem:(NSInteger *)selectedIndex
The token field cell sending the message to the delegate.
The partial string that to be completed.
The index of the token being edited.
You may return by reference an index in the returned array that specifies which of the completions should be initially selected. If you do not want an initial selection, return NULL.
An array of strings for completing substring.
The default behavior provides no completions.
NSTokenFieldCell.hAllows the delegate to provide a string to be displayed as a proxy for the represented object.
- (NSString *)tokenFieldCell:(NSTokenFieldCell *)tokenFieldCell displayStringForRepresentedObject:(id)representedObject
If you return nil or do not implement this method, then representedObject is displayed as the string.
NSTokenFieldCell.hAllows the delegate to provide a string to be edited as a proxy for the represented object.
- (NSString *)tokenFieldCell:(NSTokenFieldCell *)tokenFieldCell editingStringForRepresentedObject:(id)representedObject
If you return nil or do not implement this method, then the value returned by tokenFieldCell:displayStringForRepresentedObject: is used for editing.
NSTokenFieldCell.hAllows the delegate to specify whether the represented object provides a menu.
- (BOOL)tokenFieldCell:(NSTokenFieldCell *)tokenFieldCell hasMenuForRepresentedObject:(id)representedObject
By default tokens have no menus.
NSTokenFieldCell.hAllows the delegate to provide a menu for the specified represented object.
- (NSMenu *)tokenFieldCell:(NSTokenFieldCell *)tokenFieldCell menuForRepresentedObject:(id)representedObject
The returned menu should be autoreleased. By default tokens do not return menus.
NSTokenFieldCell.hAllows the delegate to return an array of objects representing the data read from pboard.
- (NSArray *)tokenFieldCell:(NSTokenFieldCell *)tokenFieldCell readFromPasteboard:(NSPasteboard *)pboard
NSTokenFieldCell.hAllows the delegate to provide a represented object for the string being edited.
- (id)tokenFieldCell:(NSTokenFieldCell *)tokenFieldCell representedObjectForEditingString:(NSString *)editingString
The token field cell sending the message to the delegate.
The string being edited.
A represented object associated with editingString.
If your application uses some object other than an NSString object for their represented objects, you should return a new, autoreleased instance of that object from this method.
NSTokenFieldCell.hAllows the delegate to validate the tokens to be added to the receiver at a given index.
- (NSArray *)tokenFieldCell:(NSTokenFieldCell *)tokenFieldCell shouldAddObjects:(NSArray *)tokens atIndex:(NSUInteger)index
The token field cell sending the message to the delegate.
An array of tokens to be added to the receiver.
The index in the receiver where the tokens are to be added.
An array of validated tokens.
The delegate can return the array unchanged or return a modified array of tokens. To reject the add completely, return an empty array. Returning nil causes an error.
NSTokenFieldCell.hAllows the delegate to return the token style for editing the specified represented object.
- (NSTokenStyle)tokenFieldCell:(NSTokenFieldCell *)tokenFieldCell styleForRepresentedObject:(id)representedObject
The delegate should return NSDefaultTokenStyle, NSPlainTextTokenStyle or NSRoundedTokenStyle.
NSTokenFieldCell.hAllows the delegate the opportunity to write custom pasteboard types to the pasteboard for the represented objects in objects.
- (BOOL)tokenFieldCell:(NSTokenFieldCell *)tokenFieldCell writeRepresentedObjects:(NSArray *)objects toPasteboard:(NSPasteboard *)pboard
The display strings for the represented objects have already been placed on the pasteboard as both NSStringPboardType and an array of NSString objects.
NSTokenFieldCell.hThe NSTokenStyle type provides storage for values defined in “NSTokenStyle Values”.
typedef NSUInteger NSTokenStyle;
NSTokenFieldCell.hThe NSTokenStyle constants define how tokens are displayed and editable in the NSTokenFieldCell. These values are used by tokenStyle, setTokenStyle: and the delegate method tokenFieldCell:styleForRepresentedObject:.
enum {
NSDefaultTokenStyle,
NSPlainTextTokenStyle,
NSRoundedTokenStyle
};
NSDefaultTokenStyleStyle best used for keyword type tokens.
Available in Mac OS X v10.4 and later.
Declared in NSTokenFieldCell.h
NSPlainTextTokenStyleStyle to use for data you want represented as plain-text and without any token background.
Available in Mac OS X v10.4 and later.
Declared in NSTokenFieldCell.h
NSRoundedTokenStyleStyle best used for address type tokens.
Available in Mac OS X v10.4 and later.
Declared in NSTokenFieldCell.h
NSTokenFieldCell.h
Last updated: 2007-03-05