Each PowerBuilder control has two drag-and-drop properties:
DragAuto
DragIcon
The DragAuto property DragAuto is a boolean property.
Value |
Meaning |
---|---|
TRUE |
When the object is clicked, the control is placed automatically in drag mode |
FALSE |
When the object is clicked, the control is not placed automatically in drag mode; you have to put the object in drag mode manually by using the Drag function in a script |
To specify automatic drag mode for a control in the Window painter:
Select the Other property page in the Properties view for the control.
Check the Drag Auto check box.
The DragIcon property Use the DragIcon property to specify the icon you want displayed when the control is in drag mode. The DragIcon property is a stock icon or a string identifying the file that contains the icon (the ICO file). The default icon is a box the size of the control.
When the user drags a control, the icon displays when the control is over an area in which the user can drop it (a valid drop area). When the control is over an area that is not a valid drop area (such as a window scroll bar), the No-Drop icon displays.
Select the Other property page in the Properties view for the control.
Choose the icon you want to use from the list of stock icons or use the Browse button to select an ICO file and click OK.
Creating icons To create icons, use a drawing application that can save files in the Microsoft Windows ICO format.
There are six drag-and-drop events.
Event |
Occurs |
---|---|
BeginDrag |
When the user presses the left mouse button in a ListView or TreeView control and begins dragging |
BeginRightDrag |
When the user presses the right mouse button in a ListView or TreeView control and begins dragging |
DragDrop |
When the hot spot of a drag icon (usually its center) is over a target (a PowerBuilder control or window to which you drag a control) and the mouse button is released |
DragEnter |
When the hot spot of a drag icon enters the boundaries of a target |
DragLeave |
When the hot spot of a drag icon leaves the boundaries of a target |
DragWithin |
When the hot spot of a drag icon moves within the boundaries of a target |
Each PowerBuilder control has two functions you can use to write scripts for drag-and-drop events.
Function |
Action |
---|---|
Drag |
Starts or ends the dragging of a control |
DraggedObject |
Returns the control being dragged |
For more information about these events and functions, see the PowerScript Reference.