Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Treeview HitTest not firing when dragover target
Message
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00351086
Message ID:
00351294
Views:
15
The HitTest method expects the co-ordinates to be in TWIPS. The following extract should give you the general idea:-


*** ActiveX Control Event ***
LPARAMETERS data, effect, button, shift, x, y, state

LOCAL loDropNode

loDropNode = This.HitTest(x * lnTwipsX, y * lnTwipsY)

if vartype(loDropNode) $ "O"
*!* loDropNode is a valid node object.
else
*!* loDropNoed is NOT a valid node object.
endif



The next example illustrates how to get the lnTwipsX and lnTwipsY values using the Windows API:-


LOCAL lnHWND
LOCAL lnHDC
LOCAL lnPixelsPerInchX
LOCAL lnPixelsPerInchY

*!* Pinch some constants from WINGDI.H
#define LOG_PIXELS_X 88
#define LOG_PIXELS_Y 90
#define TWIPS_PER_INCH 1440

declare integer GetDeviceCaps in WIN32API INTEGER lnHDC, INTEGER lnIndex
declare integer GetActiveWindow in WIN32API
declare integer GetDC in WIN32API INTEGER lnHDC

lnHWND = GetActiveWindow()
lnHDC = GetDC(lnHWND)

lnPixelsPerInchX = GetDeviceCaps(lnHDC, LOG_PIXELS_X)
lnPixelsPerInchY = GetDeviceCaps(lnHDC, LOG_PIXELS_Y)

lnTwipsX = TWIPS_PER_INCH / lnPixelsPerInchX
lnTwipsY = TWIPS_PER_INCH / lnPixelsPerInchY
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform