onDrag (Callback)


allow = onDrag (idControl, code, item, x, y)

This callback is invoked when the user attempts to drag a list box or tree view item.

Parameter Description
idControl The id of the control that generated the event
code A constant identifying what kind of dragging event occured
item The item in the control to which this event applies
x The x position of the mouse, relative the the upper left hand corner of the control
y The y position of the mouse, relative to the upper left hand corner of the control

Returns

$$TRUE to allow the dragging, $$FALSE to cancel it

Remarks

This is a callback function. You must supply this function yourself. To register this callback, use the WinXRegOnDrag function.

Possible values for code are:

$$DRAG_START
The dragging operation is beginning. If you cancel here the entire operation is denied. The item parameter contains the item which is to be dragged.
$$DRAG_DRAGGING
The item is being dragged and has not yet been released. If you cancel here, the cursor becomes a crossed circle indicating to the user that this is not a valid place to drop the item. The item parameter contains the item underneath the cursor, or an invalid value (0 or -1 depending on the control) if there is no item underneath the cursor.
$$DRAG_DONE
The user dropped the item. It makes no difference what you return for this code. The item parameter is the item underneath the mouse cursor, or an invalid value if there is no item underneath the cursor

Different controls implement dragging in different ways, and hence will make slightly different use of this function.

Examples

See the dragList and treeView examples in the samples folder.

Related Links

WinXRegOnDrag