Platforms to show: All Mac Windows Linux Cross-Platform
Back to CustomNSToolbarMBS class.
CustomNSToolbarMBS.allowsSizeMode(mode as Integer, SuperAllows as boolean) as boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
event | Cocoa Toolbar | MBS MacControls Plugin | 13.1 | ✅ Yes | ❌ No | ❌ No | ❌ No |
If you have nothing in the event, the default behavior is to allow all.
You can return false for a mode to disable it. e.g. NSToolbarSizeModeSmall
SuperAllows parameter tells you if mode is enabled by default.
CustomNSToolbarMBS.itemForItemIdentifier(identifier as string, willBeInsertedIntoToolbar as boolean) as NSToolbarItemMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
event | Cocoa Toolbar | MBS MacControls Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No |
itemIdentifier: The identifier for the requested item.
willBeInsertedIntoToolbar: True if the item will be immediately inserted into the toolbar. If flag is false the toolbar item is being requested for display in the toolbar customization sheet and should always be enabled or provide some other canonical representation. If you ignore this parameter the same toolbar item will be used in the toolbar and in the customization sheet.
Return Value
The toolbar item for the specified toolbar and identifier. Return nil to indicate that the identified kind of toolbar item is not supported. When an item is requested again, you may return the same NSToolbarItem object returned earlier or a different instance.
Implement this method to create new toolbar item instances. This method is called lazily on behalf of a toolbar instance, which must be the sole owner of the toolbar item. A toolbar may ask again for a kind of toolbar item already supplied to it, in which case this method may return the same toolbar item it returned before or a different one. If your delegate services multiple toolbars, each attached to a different window, it is best to return a different item for each toolbar—an NSToolbarItem object can only be in one toolbar at a time.
If the item is a custom view item, the NSView object must be fully formed when the item is returned. Do not assume that the returned item is going to be added as an active item in the toolbar, as it could be that it will be used only in the customization palette. (The customization palette makes a copy of the returned item.)
This event must be implemented if the associated toolbar is created programatically.
Some examples using this event:
CustomNSToolbarMBS.toolbarAllowedItemIdentifiers as string()
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
event | Cocoa Toolbar | MBS MacControls Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No |
An array of toolbar item identifiers for toolbar, specifying the contents and the order of the items in the configuration palette.
Every allowed item must be explicitly listed, even the standard ones. The identifiers returned should include all of those returned by toolbarDefaultItemIdentifiers:.
This event must be implemented if the associated toolbar is created programatically.
Some examples using this event:
CustomNSToolbarMBS.toolbarDefaultItemIdentifiers as string()
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
event | Cocoa Toolbar | MBS MacControls Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No |
Return an array of toolbar item identifiers for toolbar, specifying the contents and the order of the items in the default toolbar configuration.
During initialization of toolbar, this method is called only if a toolbar configuration for the identifier of toolbar is not found in the user preferences. This method is called during initialization of the toolbar customization palette.
This event must be implemented if the associated toolbar is created programatically.
Some examples using this event:
CustomNSToolbarMBS.toolbarDidRemoveItem(item as NSToolbarItemMBS, notification as NSNotificationMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
event | Cocoa Toolbar | MBS MacControls Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No |
This method allows you to remove information related to the item that may have been cached.
Some examples using this event:
CustomNSToolbarMBS.toolbarItemAction(item as NSToolbarItemMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
event | Cocoa Toolbar | MBS MacControls Plugin | 13.1 | ✅ Yes | ❌ No | ❌ No | ❌ No |
Only for instances of CustomNSToolbarItemMBS, the plugin can forward the allowsDuplicatesInToolbar event to the CustomNSToolbarMBS, so you can handle it in a central place for all toolbar items.
CustomNSToolbarMBS.toolbarItemAllowsDuplicatesInToolbar(item as NSToolbarItemMBS) as boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
event | Cocoa Toolbar | MBS MacControls Plugin | 13.1 | ✅ Yes | ❌ No | ❌ No | ❌ No |
You use this event to override the default behavior in a subclass.
By default, if an item with the same identifier is already in the toolbar, dragging it in again will effectively move it to the new position.
If you leave this event empty (no code), you get the default behavior.
Only for instances of CustomNSToolbarItemMBS, the plugin can forward the allowsDuplicatesInToolbar event to the CustomNSToolbarMBS, so you can handle it in a central place for all toolbar items.
CustomNSToolbarMBS.toolbarItemValidate(item as NSToolbarItemMBS) as boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
event | Cocoa Toolbar | MBS MacControls Plugin | 13.1 | ✅ Yes | ❌ No | ❌ No | ❌ No |
If this event is implemented and returns false, NSToolbar will disable theItem; returning true causes theItem to be enabled.
NSToolbar only calls this method for image items.
validateis called very frequently, so it must be efficient.
If you don't have code in this event, the plugin will simply return enabled value.
This methods may not be called if you set Autovalidates to true.
Only for instances of CustomNSToolbarItemMBS, the plugin can forward the allowsDuplicatesInToolbar event to the CustomNSToolbarMBS, so you can handle it in a central place for all toolbar items.
CustomNSToolbarMBS.toolbarSelectableItemIdentifiers as string()
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
event | Cocoa Toolbar | MBS MacControls Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No |
Return an array of item identifiers that should indicate selection in the specified toolbar.
Toolbars that need to indicate item selection should return an array containing the identifiers of the selectable toolbar items.
If implemented, toolbar will display the currently selected item with a visual highlight. Clicking on an item whose identifier is selectable will automatically update the toolbar's selected item identifier, when possible. Clicking an item whose identifier is not selectable will not update the toolbar's selected item identifier.
Some examples using this event:
CustomNSToolbarMBS.toolbarWillAddItem(item as NSToolbarItemMBS, notification as NSNotificationMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
event | Cocoa Toolbar | MBS MacControls Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No |
If you need to cache a reference to a toolbar item or need to set up some initial state before a toolbar item is added, this is where to do it.
Some examples using this event:
The items on this page are in the following plugins: MBS MacControls Plugin.