Entering content frame

Function documentationDrag and Drop Locate the document in its SAP Library structure

Use

Drag and drop allows the user to select an object from one part of a custom control (source) and drop it on another part of a custom control (target). An action occurs in the second part that depends on the object type. Source and target may be either the same control or different controls.

Prerequisites

For a control to support drag and drop, the control wrapper must provide drag and drop events. You must then write handler methods for these events in your program. The events are registered automatically by the relevant control wrapper.

Features

A particular drag and drop behavior is set for each custom control. This behavior may be set globally for all elements of the control (for example, SAP Textedit), or you may be able to define a different behavior for each component (for example SAP Tree). Each behavior consists of one or more descriptions.

A description has the following attributes:

As soon as a drag event is triggered, you must use the corresponding handler method to find out the affected object.

You must also define the action that is to be carried out on the drop event. The action usually depends on the object that you drop in the control.

If you assign more than one flavor to an object, you must define which flavor is to be used. You do this in the handler for another event.

Once the drop event is finished, you can use a further event to implement additional actions. This is particularly useful for deleting the dropped object from the source after a move operation.

Activities

Whenever you provide a drag and drop function to move objects, you should always provide an Undo function as well. You must implement this yourself in the application.

Leaving content frame