Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
URGENT, please!!! - Right Click in TreeView Control
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00137621
Message ID:
00137633
Views:
20
>How I can test a right click in a TreeView Control ?
>
>I try with MouseUp event and asking for nButton = 2, but I haven't good results. The MouseUp Event isn't called.
>
>Any suggestions ???
>
>
>Thanks in advance!


On your form:

2 new properties:
nFactorX
nFactorY

Form INIT Method:
LOCAL liHWnd, liHDC, liPixelsPerInchX, liPixelsPerInchY
#DEFINE cnLOG_PIXELS_X 88
#DEFINE cnLOG_PIXELS_Y 90
#DEFINE cnTWIPS_PER_INCH 1440
DECLARE INTEGER GetActiveWindow IN WIN32API
DECLARE INTEGER GetDC IN WIN32API INTEGER iHDC
DECLARE INTEGER GetDeviceCaps IN WIN32API INTEGER iHDC, INTEGER iIndex
liHWnd = GetActiveWindow()
liHDC = GetDC(liHWnd)
liPixelsPerInchX = GetDeviceCaps(liHDC,cnLOG_PIXELS_X)
liPixelsPerInchY = GetDeviceCaps(liHDC,cnLOG_PIXELS_Y)
this.nFactorX = cnTWIPS_PER_INCH / liPixelsPerInchX
this.nFactorY = cnTWIPS_PER_INCH / liPixelsPerInchY

TreeView MouseDown Event:
*** OLE Control Event ***
LPARAMETERS button, shift, x, y
IF button=2 && Right Button
LOCAL loNode, lnX, lnY
lnX = x * thisform.nFactorX
lnY = y * thisform.nFactorY
loNode = this.HitTest(lnX,lnY)
IF TYPE('loNode')='O' AND !ISNULL(loNode)
loNode.Selected = .t.
MessageBox(loNode.Text) && Do whatever you need to do here
ENDIF
ENDIF

HTH!
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Previous
Reply
Map
View

Click here to load this message in the networking platform