Hi, I'm using the MS Tree Control for an intranet project and am encountering a slight problem. The HitTest method of TreeView is always returning a null value during drag and drop operations. The code I'm using for this is shown below, every part of which functions fine individually except for the HitTest call in the second sub, which always returns null. Does anyone know a solution for this (and a cause) or can you point me in the direction of any existing code.
Cheers,
scrollo
Sub TreeView1_OLEStartDrag(Data,AllowedEffects)
Data.Clear
If Not TreeView1.SelectedItem Is Nothing Then
Data.SetData TreeView1.SelectedItem.Key, 1
End If
End Sub
Sub TreeView1_OLEDragDrop(Data,Effect,Button,Shift,x,y )
Dim strKey
Dim oNode, thisNode, oDragNode
oNode = TreeView1.HitTest(x,y) ' HitTest returns null
If Data.GetFormat(1) Then
strKey = Data.GetData(1)
oDragNode = TreeView1.Nodes(Int(strKey))
'On Error Resume Next
Set oDragNode.Parent = oNode
'If Err.Number = 35614 Then
' MsgBox "Can't create circular relations"
' On Error GoTo 0
'End If
Set TreeView1.DropHighlight = Nothing
End If
End Sub
Cheers,
scrollo
Sub TreeView1_OLEStartDrag(Data,AllowedEffects)
Data.Clear
If Not TreeView1.SelectedItem Is Nothing Then
Data.SetData TreeView1.SelectedItem.Key, 1
End If
End Sub
Sub TreeView1_OLEDragDrop(Data,Effect,Button,Shift,x,y )
Dim strKey
Dim oNode, thisNode, oDragNode
oNode = TreeView1.HitTest(x,y) ' HitTest returns null
If Data.GetFormat(1) Then
strKey = Data.GetData(1)
oDragNode = TreeView1.Nodes(Int(strKey))
'On Error Resume Next
Set oDragNode.Parent = oNode
'If Err.Number = 35614 Then
' MsgBox "Can't create circular relations"
' On Error GoTo 0
'End If
Set TreeView1.DropHighlight = Nothing
End If
End Sub