Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
TreeView.HitTest returns invalid reference
Message
 
To
02/03/2004 05:52:36
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00882283
Message ID:
00882350
Views:
26
In your app startup you would need code similar to this:
declare integer GetActiveWindow in WIN32API
declare integer GetDC in WIN32API integer iHDC
declare integer GetDeviceCaps in WIN32API integer iHDC,integer iIndex
* Device context
liHwnd=GetActiveWindow()
liHDC=GetDC(liHwnd)
* Pixels per Inch
liPixelsPerInchX=GetDeviceCaps(liHDC,88)
liPixelsPerInchY=GetDeviceCaps(liHDC,90)
* Twips per pixel and store
unLTVX=1440/liPixelsPerInchX
unLTVY=1440/liPixelsPerInchY
* In the treeviews mouse move you would need something like
procedure MouseMove(button, shift, x, y)
IF thisform.chkHotTracker.Value
   oNode=this.HitTest(X*unLTVX,Y*unltvY)
   if type('oNode.text')==[C]
      this.NodeClick(oNode)
   else
   ENDIF 
ELSE 
ENDIF
ENDPROC
You need to assure the node exists {if type('oNode.text')==[C]}, before you treat it like one:)

There is a demo of this in download #16575

>Hi there,
>
>Has anyone used the TreeView.HitTest method before and have it return a reference which is not a Node?
>
>oNode = TreeView.HitTest(x,y)
>? TYPE('oNode') && returns "O"
>? oNode.Text && returns "oNode is not an object"
>
>Any insights to the problem will be appreciated.
>
>Thanks
Imagination is more important than knowledge
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform