Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OLEDragDrop event in Treeview control
Message
From
27/11/2001 13:16:30
 
 
To
27/11/2001 11:33:43
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00586034
Message ID:
00586465
Views:
16
Thanks for you reply Doug. I tried your suggestions and I am still having problems. Using your method of getting the X and Y I was always getting x=15 and y=15. The way I was doing it before was always x=15 y=18. These numbers didn't change no matter where I dragged the node. Perhaps I am missing something somewhere else?

I also tried setting the autoyield to .f. and issuing the sys(2333,0) command, I think the test passed because nothing different happened.

Thanks,
Chris

>Hi Chris.
>
>>I am trying to add Drag and Drop with a treeview control. I am basically following the example in the July 2001 issue of FoxPro Advisor. (starting on page 18) Anyways I am trying figure out the node onto which the user dragged the object. Basically they have
>>
>>lc = data.getdata(1)
>>lnXFactor = 1440/96*(13/FONTMETRIC(1, "Arial", 10, "B"))
>>lnYFactor = 1440/96*(13/FONTMETRIC(7, "Arial", 10, "B"))
>>lc2 = this.hitTest(x * lnXFactor, y * lnYFactor)
>>
>
>Here's the method I use to get lnXFactor and lnYFactor:
local liHWnd, ;
>  liHDC, ;
>  liPixelsPerInchX, ;
>  liPixelsPerInchY
>
>#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)
>
>* Get the twips per pixel.
>
>lnTreeFactorX = cnTWIPS_PER_INCH/liPixelsPerInchX
>lnTreeFactorY = cnTWIPS_PER_INCH/liPixelsPerInchY
This works reliably for me.
>
>One other thing: do this to ensure the TreeView works properly in VFP:
_VFP.AutoYield = .F.
>sys(2333, 0)
Doug
Previous
Reply
Map
View

Click here to load this message in the networking platform