| Home | Previous Lesson: Drag and Drop Next Lesson: Drag-n-Drop Attributes |
Can I drag any PowerBuilder object? No. All descendent objects to the "DragObject" are draggable. Objects that are inherited from "Draw" object, such as line, circle, rectangle, etc, do not have drag-n-drop functionality. All draggable objects have the following events:
| DragEnter: This event
gets fired in the target object, as soon as dragged
object enters the target object boundaries. What you can
do in this event? You can write code to check the
object type & class that is being dropped and
change the icon to stop icon if the dragged object is
not allowed to drop. |
|
| DragWithIn: As long as
the user keeps dragging the dragged object within the
target object boundaries, this event keep firing in
the target object. The need of writing code in this
event is very rare. |
|
| DragDrop: When the
dragged object is dropped on the target object, this
event fires in the target object. As soon as the user drops
the object, drag-n-drop cycle ends. Most of the
coding in the drag-n-drop functionality, you need to
write here. First thing in the code you need to do
after checking for the object type & class name
is to change the drag icon to normal mouse pointer, so
that user knows drop part is done from his side. If
you are doing any heavy duty processing in this
event, change the mouse pointer to
"HourGlass" and set it to normal when the processing
is done. |
|
| DragLeave: If the user
drags the dragged object out of the target object
boundaries without dropping, this event fires in the target
object. Typical coding in this event is, changing the
icon to the one which it was while entering into
target object boundaries. |
|
| BeginDrag, BeginRightDrag:
These two events are available only for ListView and
TreeView objects. These events occur when the user
presses the mouse button and drags. All the above
mentioned drag related events are fired only when the dragging
is enabled (we will explain about enabling drag functionality
in a moment). But, these two events are fired whether
or not dragging is enabled. |
| Home | Previous Lesson: Drag and Drop Next Lesson: Drag-n-Drop Attributes |