About drag and drop

Drag and drop allows users to initiate activities by dragging a control and dropping it on another control. It provides a simple way to make applications graphical and easy to use. For example, in a manufacturing application you might allow the user to pick parts from a bin for an assembly by dragging a picture of the part and dropping it in the picture of the finished assembly.

Drag and drop involves at least two controls: the control that is being dragged (the drag control) and the control to which it is being dragged (the target). In PowerBuilder, all controls except drawing objects (lines, ovals, rectangles, and rounded rectangles) can be dragged.

Automatic drag mode

When a control is being dragged, it is in drag mode. You can define a control so that PowerBuilder puts it automatically in drag mode whenever a Clicked event occurs in the control, or you can write a script to put a control into drag mode when an event occurs in the window or the application.

Drag icons

When you define the style for a draggable object in the Window painter, you can specify a drag icon for the control. The drag icon displays when the control is dragged over a valid drop area (an area in which the control can be dropped). If you do not specify a drag icon, a rectangle the size of the control displays.

Drag events

Window objects and all controls except drawing objects have events that occur when they are the drag target. When a dragged control is within the target or dropped on the target, these events can trigger scripts. The scripts determine the activity that is performed when the drag control enters, is within, leaves, or is dropped on the target.