Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
URGENT, please!!! - Right Click in TreeView Control
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00137621
Message ID:
00137633
Vues:
19
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform