Platforms to show: All Mac Windows Linux Cross-Platform

NSSearchToolbarItemMBS class

Superclass: NSToolbarItemMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Cocoa Toolbar MBS MacControls Plugin 24.5 ✅ Yes ❌ No ❌ No ❌ No Desktop only
A toolbar item that contains a search field optimized for performing text-based searches.
Example
// put a search field into the toolbar, which collapses to a button when space is short (macOS 11 or newer)
// Return it in the itemForItemIdentifier event of your CustomNSToolbarMBS subclass, see there.
Var search As New NSSearchToolbarItemMBS("search")
search.preferredWidthForSearchField = 200
search.resignsFirstResponderWithCancel = True

Var field As NSSearchFieldMBS = search.searchField
field.placeholderString = "Search documents"

NSSearchToolbarItem automatically resizes to accommodate typing when the focus switches to the toolbar item. When the toolbar is low on space, the system may collapse the search item into a button representation, which then expands to a full search field when the user clicks on it.

Requires macOS 11.0
Subclass of the NSToolbarItemMBS class.

Superclass NSToolbarItemMBS

Constants

Constant Value Description
NSToolbarItemVisibilityPriorityHigh 1000 One of the visibility priority constants. When a toolbar does not have enough space to fit all its items, it must push some items into the overflow menu. These values allow you to suggest a priority for a toolbar item. more
NSToolbarItemVisibilityPriorityLow -1000 One of the visibility priority constants. When a toolbar does not have enough space to fit all its items, it must push some items into the overflow menu. These values allow you to suggest a priority for a toolbar item. more
NSToolbarItemVisibilityPriorityStandard 0 One of the visibility priority constants. When a toolbar does not have enough space to fit all its items, it must push some items into the overflow menu. These values allow you to suggest a priority for a toolbar item. more
NSToolbarItemVisibilityPriorityUser 2000 One of the visibility priority constants. When a toolbar does not have enough space to fit all its items, it must push some items into the overflow menu. These values allow you to suggest a priority for a toolbar item. more

Styles

Constant Value Description
NSToolbarItemStylePlain 0 A plain style maintains the item’s standard appearance.
NSToolbarItemStyleProminent 1 For macOS 26 or newer.

This class has no subclasses.

Blog Entries

Xojo Developer Magazine

Release notes

Some related classes:


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


NSSearchFieldMBS   -   NSSecureTextFieldMBS


The biggest plugin in space...