The OpenD Programming Language

DropPackage.getData

Gets data from the drop and optionally accepts it.

struct DropPackage
void
getData
(,
DraggableData.FormatId format
,
void delegate
(
scope ubyte[] data
)
dg
)

Parameters

acceptedAction DragAndDropAction

the action to report back to the ender. If it is DragAndDropAction.none, you are just inspecting the data, but not accepting the drop.

This is useful to tell the sender that you accepted a move, for example, so they can update their data source as well. For other cases, accepting a drop also indicates that any memory associated with the transfer can be freed.

Calling getData again after accepting a drop is not permitted.

format DraggableData.FormatId

the format you want, from availableFormats. Use DraggableData.getFormatId to convert from a MIME string or well-known standard format.

dg void delegate
(
scope ubyte[] data
)

delegate to receive the data asynchronously. Please note this delegate may be called immediately, never be called, or be called somewhere in between during event loop processing depending on the platform, requested format, and other conditions beyond your control.

Return Value

Type: void

void because the data is fed asynchronously through the dg parameter.

Throws

if format was not compatible with the availableFormats or if the drop has already been accepted.

Meta

History

Included in first release of DropPackage.