TreeView Drag n Drop don't allow dropping a parent into a child 
Author Message
 TreeView Drag n Drop don't allow dropping a parent into a child

I'm doing up this treeview control with drag'n drop.  I need to stop the
drop if a parent is being droped into one of it's children.  Much like
Explorer will stop you.

In order to determine that the node being dropped is not a parent or the
destination, do I have to loop through the nodes checking the keys and such.
Or (hopefully) there's a simplier method that has eluded me so far.

Suggestions.
Jeff



Sun, 25 Nov 2001 03:00:00 GMT  
 TreeView Drag n Drop don't allow dropping a parent into a child
You can check the Parent property of the node being dropped on. If it is the
same as the node being dragged, stop them.

Private Sub tv_OLEDragDrop(Index As Integer, Data As MSComctlLib.DataObject,
Effect As Long, Button As Integer, Shift As Integer, x As Single, Y As
Single)
    Dim CurrentNode As Object

    Set CurrentNode = tv.HitTest(x, Y) ' get the node being dropped to
    If CurrentNode.parent.key = Node_Being_Dragged.key Then
        ' you have found a node being dragged onto one of it's children
        Exit Sub
    End If


Quote:
> I'm doing up this treeview control with drag'n drop.  I need to stop the
> drop if a parent is being droped into one of it's children.  Much like
> Explorer will stop you.

> In order to determine that the node being dropped is not a parent or the
> destination, do I have to loop through the nodes checking the keys and
such.
> Or (hopefully) there's a simplier method that has eluded me so far.

> Suggestions.
> Jeff



Tue, 27 Nov 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. ActiveX TreeView control not allowing drag drop

2. ActiveX TreeView control not allowing drag drop

3. Treeview Drag 'n' Drop

4. Treeview Drag 'n' Drop

5. Drag-drop events don't trigger in listview

6. ActiveX TreeView Drag 'n Drop

7. HELP : Treeview and drag'n drop problem.

8. VB4: Drag'n Drop with TreeView

9. ActiveX TreeView Drag 'n Drop

10. Drag/drop from Explorer TreeView to my VB TreeView

11. Drag/drop from Explorer TreeView to my VB TreeView

12. Allow user to drag/drop new control at runtime

 

 
Powered by phpBB® Forum Software