# Directives

DROP..ON | Drag and Drop

## Formats

1. | Define Drag & Drop: | DROP source_ctl_id ON dest_ctl_id RETURN new_ctl_id
2. | Remove Logic: | DROP source_ctl_id ON dest_ctl_id REMOVE
3. | Temporarily Disable: | DROP source_ctl_id ON dest_ctl_id DISABLE
4. | Re-Enable Drag & Drop: | DROP source_ctl_id ON dest_ctl_id ENABLE

Where:

dest_ctl_id | Unique numeric identifier for the destination control or zero for the window itself.
new_ctl_id | CTL signal that is generated when the drop occurs on the destination object. Avoid integers that conflict with keyboard definitions (e.g. 4 cancels CTL=4 for the F4 key) or special negative CTL values set by the system. See Negative CTL Definitions.
source_ctl_id | Unique numeric identifier for the source control or the keyword FILE. See External File Dragging.

## Description

The Drag and Drop feature allows for copying or moving of information from one object to another object. The drop event is triggered when a mouse is used to select information from the source object, drag the selection to another object, and deposit the information at the new location. The application is responsible for adding the information to the destination object and removing it from the source object.

The available Drag From or source controls are multi-lines and various types of list boxes, drop boxes, and grids.

The available Drop On or destination controls are buttons, check boxes, drop boxes, grids, multi-lines, list boxes, radio buttons, tri-state boxes. The highlighting of items on which the drop will occur is not supported in simple or formatted list boxes; however, this is supported in list view, report view, and tree view objects.

#### Note:
When using the DISABLE syntax, the cursor will still change indicating that the drop is valid, however the signal indicating the drop took place is not generated.

## External File Dragging

You can also allow external applications, such as Windows Explorer, to drop file names onto an input control such as a list box, tree view, or multi-line by specifying FILE as the name of the source_ctl_id.

> DROP FILE ON dest_ctl_id RETURN new_ctl_id

Whenever a file is dropped onto the control, the system will generate the CTL event specified by new_ctl_id.

The application can get a list of the file pathnames being dropped from the FIN(0, "DROPFILES") function call. All pathnames will be fully expanded and separated by a SEP character.

(The ability to detect a DROP of a file was added in PxPlus v6.30.)