Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tree Control HitTest

Status
Not open for further replies.

scrollo

Programmer
Aug 13, 2002
1
GB
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top