Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSDraggingItemMBS class.

NSDraggingItemMBS.Constructor(item as NSPasteboardItemMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Drag & Drop MBS MacCocoa Plugin 13.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Initializes a dragging item using the specified content.

item: The object that provides the dragging content.

When the developer creates an NSDraggingItem instance, it is for use with the view method beginDraggingSessionWithItems. During the invocation of that method, the item is placed onto the dragging pasteboard for the NSDraggingSession that contains the dragging item instance.

Available in OS X v10.7 and later.

NSDraggingItemMBS.draggingFrame as NSRectMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Drag & Drop MBS MacCocoa Plugin 13.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The frame of the dragging item.

The dragging frame provides the spatial relationship between NSDraggingItem instances when the dragging formation is set to NSDraggingFormationNone.

The exact coordinate space of this rectangle is dependent on where it is used. The view that initiated the drag using beginDraggingSessionWithItems or the view your pass to the NSDraggingSession instance implantation of enumerateDraggingItemsWithOptions.

Available in OS X v10.7 and later.
(Read and Write computed property)

Some examples using this property:

NSDraggingItemMBS.item as Variant

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Drag & Drop MBS MacCocoa Plugin 13.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns the pasteboard reader or writer object dependent on the context of where this dragging item is used. (read-only)

When you create an NSDraggingItem instance, item is the pasteboardWriter passed to Constructor.

NSDraggingItemMBS.setDraggingFrame(frame as NSRectMBS, contents as Variant)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Drag & Drop MBS MacCocoa Plugin 13.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Sets the item's dragging frame and contents.

frame: The item content frame in the same coordinate space that the draggingFrame.
contents: The item contents to display when dragging. Typically this is an NSImage, but a CGImageRef will also work.

Alternate single image component setter.

This method simplifies modifying the components of an NSDraggingItem when there is only one component.

This is a convenience method. This method sets the draggingFrame and creates a single NSDraggingImageComponent instance with one image corresponding to the NSDraggingImageComponentIconKey key. You should only use this method under the following conditions: the drag image for this item is composed of a single image., or there are a reasonable number of dragging item instances being created or enumerated.

This method will set the draggingFrame and imageComponents properties.
Available in OS X v10.7 and later.

Some examples using this method:

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


The biggest plugin in space...