Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Drag & drop with a treeview
Message
From
29/09/1998 13:37:16
Tom Kreinbring
Thomas Kreinbring & Associates
Temple City, California, United States
 
 
To
29/09/1998 10:46:06
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00141941
Message ID:
00142031
Views:
33
Hello Again:

I included the following code in the Load Event of my form:

*
* The ActiveX control dual interface (VTABLE binding) is an optimization
* supported by Visual FoxPro. If an ActiveX control doesn’t use the dual
* interface, you can disable the optimization while using that control.
*
* Disable ActiveX Control Dual Interface
*

=Sys(2333,0)

*
* Calculate the conversion between VFP window units (in pixels) and
* TreeView window units (in twips)
*

Local ;
liHWnd, ;
liHDC, ;
liPixelsPerInchX, ;
liPixelsPerInchY, ;
;
lcItem

*
* Define some contants
*

#Define cnLog_Pixels_X 88
* from WINGDI.H

#Define cnLog_Pixels_Y 90
* from WINGDI.H

#Define cnTwips_Per_Inch 1440
* 1440 twips per inch

*
* Declare some Windows API functions
*

Declare integer GetActiveWindow in WIN32API

Declare integer GetDC in WIN32API ;
integer iHDC

Declare integer GetDeviceCaps in WIN32API ;
integer iHDC, integer iIndex

*
* Get a device context for VFP
*

liHWnd = GetActiveWindow()
liHDC = GetDC(liHWnd)

*
* Get the pixels per inch
*

liPixelsPerInchX = GetDeviceCaps(liHDC, cnLog_Pixels_X)
liPixelsPerInchY = GetDeviceCaps(liHDC, cnLog_Pixels_Y)

With ThisForm

*
* Get the twips per pixel
*

.nTreeFactorX = cnTwips_Per_Inch / liPixelsPerInchX
.nTreeFactorY = cnTwips_Per_Inch / liPixelsPerInchY

EndWith


**************

Here is a sample of my HitTest() placed in the OleDragDrop Event:

LPARAMETERS data, effect, button, shift, x, y

Private ;
lcCategory, ;
lcNodeParent, ;
;
lnX, ;
lnY, ;
;
loNewNode, ;
loNode

With Thisform

If Not Empty( .cDraggedNodeKey )

* Convert X & Y to twips (TreeView window units)

lnX = X * .nTreeFactorX
lnY = Y * .nTreeFactorY

loNode = .OleTree.HitTest( lnX, lnY )

If Not IsNull( loNode )

******

Hope this helps!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform