The OleStartDrag event is fired before the control has evaluated which item the user is dragging over. This means it is impossible to determine on a node-by-node basis whether the item can be dropped on an item. |
Moved OleStartDrag event after the current drag item has been evaluated. This allows you to set the Effect for the drag on a node by node basis using code like this:
Private Sub tvw_OLEDragOver(Data As DataObject, _
Effect As Long, _
Button As Integer, _
Shift As Integer, _
x As Single, y As Single, State As Integer)
Dim nodeDrag as cTreeViewNode
Dim nodeOver as cTreeViewMode
Effect = vbDropEffectNone
Set nodeDrag = tvw.NodeFromDragData(Data)
Set nodeOver = tvw.DragInsertNode
If Not(nodeDrag Is Nothing) And _
Not(nodeOver Is Nothing) Then
‘ Perform check here if ok to drop on nodeOver
If OkToDropOn(nodeOver, nodeDrag) Then
Effect = vbDropEffectCopy
End If
End If
End Sub
|