# 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                                               |
| ---------------------------------------------------------------------------- | ------------------------------------------------------ | ----------------------------------------------------- |
| [Number](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/number) | [COPY](#copy)                                          | Constant for copy drag operation.                     |
| [String](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/string) | [MIME\_TYPE\_SERVOY](#mime_type_servoy)                | Constant used as mime type for servoy objects.        |
| [String](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/string) | [MIME\_TYPE\_SERVOY\_RECORD](#mime_type_servoy_record) | Constant used as mime type for servoy record objects. |
| [Number](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/number) | [MOVE](#move)                                          | Constant for move drag operation.                     |
| [Number](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/number) | [NONE](#none)                                          | Constant for no drag operation.                       |

## Constants Detailed

### COPY

Constant for copy drag operation.

**Type**\
[Number](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/number)

**Sample**

```js
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](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/string)

**Sample**

```js
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](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/string)

**Sample**

```js
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](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/number)

**Sample**

```js
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](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/number)

**Sample**

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

	return DRAGNDROP.NONE;
}
```

***
