Platforms to show: All Mac Windows Linux Cross-Platform

NSTokenFieldMBS class

Super class: NSTextFieldMBS

Type Topic Plugin Version macOS Windows Linux Console & Web iOS
class Cocoa MBS MacControls Plugin 12.5 Yes No No Yes, macOS only No
Function: 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.

In MBS Plugin the objects must be strings or numbers. With plugin version 12.5, you can also use normal Xojo objects.

In OS X v10.4, NSTokenField trims whitespace around tokens but it does not trim whitespace in OS X versions 10.5.0 and 10.5.1. In OS X v10.5.2, you get whitespace-trimming behavior by either linking against the v10.4 binary or linking against the v10.5 binary and not implementing the representedObjectForEditingString event. If you do not want the whitespace-trimming behavior, link against the v10.5 binary and implement this method, returning the editing string if you have no represented object.

Please note: Due to the way the plugin is implemented the Action, textShouldEndEditing and textShouldBeginEditing events do nothing, so please use tokenFieldAction, tokenFieldTextShouldEndEditing and tokenFieldTextShouldBeginEditing.
Subclass of the NSTextFieldMBS class.

Feedback, Comments & Corrections

Token Styles

Constant Value Description
NSDefaultTokenStyle 0 Style best used for keyword type tokens.
Available in OS X v10.4 and later.
NSPlainTextTokenStyle 1 Style to use for data you want represented as plain-text and without any token background.
Available in OS X v10.4 and later.
NSRoundedTokenStyle 2 Style best used for address type tokens.
Available in OS X v10.4 and later.

Super class NSTextFieldMBS

Super class NSControlMBS

Super class NSViewMBS

Window Order Constants

Constant Value Description
NSWindowAbove 1 Moves the window above the indicated window.
NSWindowBelow -1 Moves the window below the indicated window.
NSWindowOut 0 Moves the window off the screen.

Super class NSResponderMBS

Sub classes:

Some properties using for this class:

Some examples which use this class:

Blog Entries

The items on this page are in the following plugins: MBS MacBase Plugin, MBS MacCocoa Plugin, MBS MacControls Plugin.

NSTimeZoneMBS   -   NSToolbarItemGroupMBS

The biggest plugin in space...

MBS FileMaker Plugins