HitTest Method always fails to return a node

Summary

Id: 13463.4
Type: Bug Bug
Current Status: Resolved

Detail

18 Nov 2003 Open Ed Epstein

I’m trying to use the HitTest method to give me the node at X,Y. It gives an Invalid Procedure Call or Argument:

Dim NodeW as Ctreeviewnode
 
Set Nodew = Plist.HitTest(x,y)  ' FailureAh
NodeW = PList HitTest(x,y)      ' Failure

I have tried everything I could think of to get it to work. I cannot assign the return value of the method to a node.

Ed Epstein

Contact Point LLC

19 Nov 2003 Resolution Identified Steve McMahon

This is a copy/paste type bug. The arrowed line in the code is wrong:

Public Function hitTest(ByVal X As Single, ByVal Y As Single) As cTreeViewNode
   '
Dim tVHT As TVHITTESTINFO
Dim lID As Long
 
   fUnScale X, Y, tVHT.pt.X, tVHT.pt.Y
   SendMessage m_hWnd, TVM_HITTEST, 0, tVHT
   If Not (tVHT.hItem = 0) Then
>>      lID = m_colIDs(CStr(tVHT.hItem))
      Dim nod As New cTreeViewNode
      nod.fInit Me, lID
      Set hitTest = nod
   End If
   '
End Function

It should read

       lID = fIDForhItem(hItem)
23 Nov 2003 Resolved Steve McMahon

Fixed.