Platforms to show: All Mac Windows Linux Cross-Platform
Back to NSPasteboardMBS class.
NSPasteboardMBS.accessBehavior as Integer
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Clipboard | MBS MacBase Plugin | 25.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
The user can customize this behavior per-app in System Settings for any app that has triggered a pasteboard access alert in the past.
Returns AccessBehaviorAlwaysAllow on macOS 15.4.
Value is -1 if unknown, e.g. on older macOS versions.
NSPasteboardMBS.addType(type as string) as Integer
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Clipboard | MBS MacBase Plugin | 10.4 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
types: An array of strings, each of which specifies a type of data that can be provided to the pasteboard.
Returns the new change count, or 0 if there was an error adding the types.
This method adds promises for the specified types to the first pasteboard item.
You use this methods to declare additional types of data for the first pasteboard item in the receiver. You can also use it to replace existing types added by a previous declareTypes or addTypes call.
The types parameter specifies the types of data you are promising to the pasteboard. The types should be ordered according to the preference of the source application, with the most preferred type coming first (typically, the richest representation). New types are added to the end of the list containing any existing types, if any.
If you specify a type that has already been declared, this method replaces the owner of that type with the value in newOwner. In addition, any data already already written to the pasteboard for that type is removed.
NSPasteboardMBS.addTypes(types() as string) as Integer
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Clipboard | MBS MacBase Plugin | 10.4 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
types: An array of strings, each of which specifies a type of data that can be provided to the pasteboard.
Returns the new change count, or 0 if there was an error adding the types.
This method adds promises for the specified types to the first pasteboard item.
You use this methods to declare additional types of data for the first pasteboard item in the receiver. You can also use it to replace existing types added by a previous declareTypes or addTypes call.
The types parameter specifies the types of data you are promising to the pasteboard. The types should be ordered according to the preference of the source application, with the most preferred type coming first (typically, the richest representation). New types are added to the end of the list containing any existing types, if any.
If you specify a type that has already been declared, this method replaces the owner of that type with the value in newOwner. In addition, any data already already written to the pasteboard for that type is removed.
NSPasteboardMBS.changeCount as Integer
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Clipboard | MBS MacBase Plugin | 10.4 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
The change count starts at zero when a client creates the receiver and becomes the first owner. The change count subsequently increments each time the pasteboard ownership changes.
The change count is also returned from clearContents and declareTypes. You can therefore record the change count at the time that you take ownership of the pasteboard and later compare it with the value returned from changeCount to determine whether you still have ownership.
NSPasteboardMBS.clearContents as Integer
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Clipboard | MBS MacBase Plugin | 10.4 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
Clears the existing contents of the pasteboard, preparing it for new contents. This is the first step in providing data on the pasteboard.
Available in Mac OS X v10.6 and later.
Some examples using this method:
- /MacCocoa/Service in Cocoa/TestService
- /MacControls/Listbox and TableView Demos/ListboxTV drop-in/Flat Only/ListBoxTV Database with DataSource
- /MacControls/Listbox and TableView Demos/ListboxTV drop-in/Flat Only/ListBoxTV Simple Demo with DataSource
- /MacControls/Listbox and TableView Demos/ListboxTV drop-in/Flat Only/ListBoxTV TableView
- /MacControls/Listbox and TableView Demos/ListboxTV drop-in/Flat Only/ListboxTV with ContainerControl Cells
- /MacControls/Listbox and TableView Demos/ListboxTV drop-in/Hierarchical & Flat/ListBoxTV OutlineView
- /MacControls/Listbox and TableView Demos/NSOutlineView/Disk Browser
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Clipboard | MBS MacBase Plugin | 10.4 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
On success the handle property is not 0.
See also:
NSPasteboardMBS.Constructor(name as string)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Clipboard | MBS MacBase Plugin | 10.4 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
On success the handle property is not 0.
See also:
NSPasteboardMBS.dataForType(type as string) as Memoryblock
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | Clipboard | MBS MacBase Plugin | 10.4 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
Returns a data object containing the data for the specified type from the first item in the receiver that contains the type, or "" if the contents of the pasteboard changed since they were last checked.
This method may also return nil if the pasteboard server cannot supply the data in time—for example, if the pasteboard's owner is slow in responding to a pasteboard:provideDataForType: message and the interprocess communication times out.
Errors other than a timeout raise a NSPasteboardCommunicationException (a NSExceptionMBS in Xojo).
If "" is returned, the application should put up a panel informing the user that it was unable to carry out the paste operation.
For standard text data types such as string, RTF, and RTFD, the text data from each item is returned as one combined result separated by newlines.
(Read and Write computed property)
NSPasteboardMBS.declareType(type as string) as Integer
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Clipboard | MBS MacBase Plugin | 10.4 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
type: An strings that specify the type of data that may be added to the new pasteboard. The types should be ordered according to the preference of the source application, with the most preferred type coming first (typically, the richest representation).
Returns the receiver's new change count.
This method is the equivalent of invoking clearContents, implicitly writing the first pasteboard item, and then calling addTypes to promise types for the first pasteboard item.
In Mac OS X v10.5 and earlier, this method is the first step in writing data to the pasteboard and must precede the messages that actually write the data. A declareTypes message essentially changes the contents of the receiver: It invalidates the current contents of the receiver and increments its change count.
NSPasteboardMBS.declareTypes(types() as string) as Integer
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Clipboard | MBS MacBase Plugin | 10.4 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
type: An array of Strings that specify the types of data that may be added to the new pasteboard. The types should be ordered according to the preference of the source application, with the most preferred type coming first (typically, the richest representation).
Returns the receiver's new change count.
This method is the equivalent of invoking clearContents, implicitly writing the first pasteboard item, and then calling addTypes to promise types for the first pasteboard item.
In Mac OS X v10.5 and earlier, this method is the first step in writing data to the pasteboard and must precede the messages that actually write the data. A declareTypes message essentially changes the contents of the receiver: It invalidates the current contents of the receiver and increments its change count.
Some examples using this method:
NSPasteboardMBS.detectMetadata(types() as String, theDelegate as detectValuesCompletedMBS, tag as variant = nil)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Clipboard | MBS MacBase Plugin | 25.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
Because this method only gives access to limited types of metadata and doesn’t allow the app to access the contents, the system doesn’t notify the user about reading the contents of the pasteboard.
For details about the metadata returned for each type, see `NSPasteboardMetadataType`.
types The metadata types to detect on the pasteboard.
theDelegate: A delegate that the system invokes after detecting metadata on the pasteboard. The delegate receives either a dictionary with the metadata types found on the pasteboard or an error if detection failed. The dictionary keys specify the matched metadata types, and the values specify the corresponding metadata.
tag: a value passed on to the delegate.
Requires macOS 15.4 or newer.
NSPasteboardMBS.detectPatterns(patterns() as String, theDelegate as detectPatternsCompletedMBS, tag as variant = nil)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Clipboard | MBS MacBase Plugin | 25.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
Because this method only gives an indication of whether a pasteboard item matches a particular pattern and doesn’t allow the app to access the contents, the system doesn’t notify the user about reading the contents of the pasteboard.
patterns: The patterns to detect on the pasteboard.
theDelegate: A delegate that the system invokes after detecting patterns on the pasteboard. The delegate receives either a set with the patterns found on the pasteboard or an error if detection failed.
tag: a value passed on to the delegate.
Requires macOS 15.4 or newer.
NSPasteboardMBS.detectValues(patterns() as String, theDelegate as detectValuesCompletedMBS, tag as variant = nil)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Clipboard | MBS MacBase Plugin | 25.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
Important: Calling this method notifies the user that the app has read the contents of the pasteboard, if a match is found.
For details about the types returned for each pattern, see shared methods.
patterns: The patterns to detect on the pasteboard.
theDelegate: A delegate that the system invokes after detecting patterns on the pasteboard. The delegate returns either dictionary with the patterns found on the pasteboard or an error if detection failed. The dictionary keys specify the matched patterns, and the values specify the corresponding content of the pasteboard.
tag: a value passed on to the delegate.
Requires macOS 15.4 or newer.
NSPasteboardMBS.name as string
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Clipboard | MBS MacBase Plugin | 10.4 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
NSPasteboardMBS.pasteboardItems as NSPasteboardItemMBS()
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Clipboard | MBS MacBase Plugin | 13.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
Returns all the items held by the receiver, or nil if there is an error retrieving pasteboard items.
Available in OS X v10.6 and later.
Some examples using this method:
- /MacControls/Listbox and TableView Demos/ListboxTV drop-in/Flat Only/ListBoxTV Database with DataSource
- /MacControls/Listbox and TableView Demos/ListboxTV drop-in/Flat Only/ListBoxTV Simple Demo with DataSource
- /MacControls/Listbox and TableView Demos/ListboxTV drop-in/Flat Only/ListBoxTV TableView
- /MacControls/Listbox and TableView Demos/ListboxTV drop-in/Flat Only/ListboxTV with ContainerControl Cells
- /MacControls/Listbox and TableView Demos/ListboxTV drop-in/Hierarchical & Flat/ListBoxTV OutlineView
- /MacControls/Listbox and TableView Demos/NSOutlineView/Disk Browser
NSPasteboardMBS.propertyListForType(type as string) as Variant
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | Clipboard | MBS MacBase Plugin | 13.5 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
dataType: The pasteboard data type containing the property-list data.
The property list for the specified type from the first item in the receiver that contains the type. This object consists of NSArray, NSData, NSDictionary, or NSString objects—or any combination thereof.
This method invokes the dataForType method.
You must send types or availableTypeFromArray before invoking propertyListForType.
(Read and Write computed property)
NSPasteboardMBS.releaseGlobally
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Clipboard | MBS MacBase Plugin | 10.4 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
After this method is invoked, no other application can use the receiver.
A temporary, privately named pasteboard can be released this way when it is no longer needed, but a standard pasteboard should never be released globally.
NSPasteboardMBS.SetPasteboardItems(items() as NSPasteboardItemMBS) as Boolean
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Clipboard | MBS MacBase Plugin | 17.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
Returns true if the array was successfully added, otherwise false.
See also:
Some examples using this method:
- /MacControls/Listbox and TableView Demos/ListboxTV drop-in/Flat Only/ListBoxTV Database with DataSource
- /MacControls/Listbox and TableView Demos/ListboxTV drop-in/Flat Only/ListBoxTV Simple Demo with DataSource
- /MacControls/Listbox and TableView Demos/ListboxTV drop-in/Flat Only/ListBoxTV TableView
- /MacControls/Listbox and TableView Demos/ListboxTV drop-in/Flat Only/ListboxTV with ContainerControl Cells
- /MacControls/Listbox and TableView Demos/ListboxTV drop-in/Hierarchical & Flat/ListBoxTV OutlineView
- /MacControls/Listbox and TableView Demos/NSOutlineView/Disk Browser
NSPasteboardMBS.SetPasteboardItems(items() as Variant) as boolean
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Clipboard | MBS MacBase Plugin | 21.4 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
This method allows you to mix NSPasteboardItemMBS, folderitem, NSURLMBS, strings, NSAttributedStringMBS and other data to put on clipboard.
Returns true if the array was successfully added, otherwise false.
See also:
NSPasteboardMBS.stringForType(type as string) as string
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| property | Clipboard | MBS MacBase Plugin | 10.4 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
A concatenation of the strings for the specified type from all the items in the receiver that contain the type, or nil if none of the items contain strings of the specified type.
This method invokes dataForType to obtain the string. If the string cannot be obtained, stringForType returns "". See dataForType for a description of what will cause "" to be returned.
In Mac OS X v10.6 and later, if the receiver contains multiple items that can provide string, RTF, or RTFD data, the text data from each item is returned as a combined result separated by newlines.
(Read and Write computed property)
NSPasteboardMBS.types as string()
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Clipboard | MBS MacBase Plugin | 10.4 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
An array of Strings containing the union of the types of data declared for all the pasteboard items on the receiver. The returned types are listed in the order they were declared.
You must send a types or availableTypeFromArray message before reading any data from an NSPasteboard object.
NSPasteboardMBS.URLFromPasteboard as string
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Clipboard | MBS MacBase Plugin | 13.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
Returns "" if pasteboard does not contain data of type NSURLPboardType.
Some examples using this method:
NSPasteboardMBS.writeURLToPasteboard(URL as string)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Clipboard | MBS MacBase Plugin | 13.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
You must declare an NSURLPboardType data type for pasteboard before invoking this method; otherwise it returns without doing anything.
The items on this page are in the following plugins: MBS MacBase Plugin.