Inherits from | |
Conforms to | |
Framework | /System/Library/Frameworks/AppKit.framework |
Availability | Available in Mac OS X v10.4 and later. |
Companion guide | |
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 the Mail application. The objects may be strings or objects that can be represented as strings. A single token field cell can be presented in an NSTokenField
control.
– 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.h
Returns the receiver’s completion delay.
- (NSTimeInterval)completionDelay
The receiver’s completion delay.
NSTokenFieldCell.h
Returns the receiver’s delegate.
- (id)delegate
The receiver’s delegate.
NSTokenFieldCell.h
Sets the receiver’s completion delay to a given delay.
- (void)setCompletionDelay:(NSTimeInterval)delay
The delay for the receiver.
NSTokenFieldCell.h
Sets the receiver’s delegate.
- (void)setDelegate:(id)anObject
The delegate for the receiver.
NSTokenFieldCell.h
Sets the receiver’s tokenizing character set to a given character set.
- (void)setTokenizingCharacterSet:(NSCharacterSet *)characterSet
The tokenizing character set for the receiver.
NSTokenFieldCell.h
Sets the token style of the receiver.
- (void)setTokenStyle:(NSTokenStyle)style
The token style for the receiver.
NSTokenFieldCell.h
Returns the receiver’s tokenizing character set.
- (NSCharacterSet *)tokenizingCharacterSet
The receiver’s tokenizing character set.
NSTokenFieldCell.h
Returns the receiver’s token style.
- (NSTokenStyle)tokenStyle
The receiver’s token style.
NSTokenFieldCell.h
Allows 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.h
Allows 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.h
Allows 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.h
Allows 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.h
Allows 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.h
Allows the delegate to return an array of objects representing the data read from pboard.
- (NSArray *)tokenFieldCell:(NSTokenFieldCell *)tokenFieldCell readFromPasteboard:(NSPasteboard *)pboard
NSTokenFieldCell.h
Allows 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.h
Allows 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.h
Allows 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.h
Allows 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.h
The NSTokenStyle
type provides storage for values defined in “NSTokenStyle Values”
.
typedef NSUInteger NSTokenStyle;
NSTokenFieldCell.h
The 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 };
NSDefaultTokenStyle
Style best used for keyword type tokens.
Available in Mac OS X v10.4 and later.
Declared in NSTokenFieldCell.h
.
NSPlainTextTokenStyle
Style 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
.
NSRoundedTokenStyle
Style best used for address type tokens.
Available in Mac OS X v10.4 and later.
Declared in NSTokenFieldCell.h
.
NSTokenFieldCell.h
© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-03-05)