DRAGNDROP

Overview

The DRAGNDROP class provides constants for handling drag-and-drop operations in Servoy. Key operations include COPY, MOVE, and NONE, which allow developers to define behavior for copying, moving, or disabling drag functionality. These constants help streamline interaction handling in custom applications. Additionally, the class defines MIME types such as MIME_TYPE_SERVOY and MIME_TYPE_SERVOY_RECORD. These constants ensure proper identification of Servoy objects and records during drag-and-drop operations, enhancing integration and compatibility within the Servoy runtime environment.

Constants Summarized

Type
Name
Summary

Constant for copy drag operation.

Constant used as mime type for servoy objects.

Constant used as mime type for servoy record objects.

Constant for move drag operation.

Constant for no drag operation.

Constants Detailed

COPY

Constant for copy drag operation.

Type Number

Sample

function startDrag(event)
{
	if(event.getElementName() == "copy")
		return DRAGNDROP.COPY;
	else if(event.getElementName() == "move")
		return DRAGNDROP.MOVE

	return DRAGNDROP.NONE;
}

MIME_TYPE_SERVOY

Constant used as mime type for servoy objects.

Type String

Sample

if (event.dataMimeType == DRAGNDROP.MIME_TYPE_SERVOY || event.dataMimeType == DRAGNDROP.MIME_TYPE_SERVOY_RECORD) {
	application.output("Dropping is allowed" );
	return true;
} else {
	application.output("Dropping is not allowed" );
	return false;
}

MIME_TYPE_SERVOY_RECORD

Constant used as mime type for servoy record objects.

Type String

Sample

if (event.dataMimeType == DRAGNDROP.MIME_TYPE_SERVOY || event.dataMimeType == DRAGNDROP.MIME_TYPE_SERVOY_RECORD) {
	application.output("Dropping is allowed" );
	return true;
} else {
	application.output("Dropping is not allowed" );
	return false;
}

MOVE

Constant for move drag operation.

Type Number

Sample

function startDrag(event)
{
	if(event.getElementName() == "copy")
		return DRAGNDROP.COPY;
	else if(event.getElementName() == "move")
		return DRAGNDROP.MOVE

	return DRAGNDROP.NONE;
}

NONE

Constant for no drag operation.

Type Number

Sample

function startDrag(event)
{
	if(event.getElementName() == "copy")
		return DRAGNDROP.COPY;
	else if(event.getElementName() == "move")
		return DRAGNDROP.MOVE

	return DRAGNDROP.NONE;
}

Last updated