march 2005 rino veryser wrote in his blog about the problems he had detecting a right-click in a treeview control.

i am currently working on an app that uses the treeview extensively.

i too needed that right-click. and this is what i came up with:

lparameters tnbutton, shift, x, y

#define mouse_left 1

#define mouse_right 2

#define twipscalc 96*1440

if tnbutton == mouse_right

   onode=this.hittest(x / twipscalc, y / twipscalc)

   if type("onode")="o" and !isnull(onode)

      this.drophighlight = onode

      wait window onode.text timeout .5

   endif

else

   dodefault()

endif

this does detect the rightclick like a charm.

calculation for the x and y position is because of the fact that the treeview control uses twips, instead of pixels.

you can read more about that in the article by doug hennog, download id 48 of the download page of this fine site.

some more info i found in one of the forms that ships with the samples.

c:\program files\microsoft visual foxpro 9\samples\solution\tahoe\listdd.scx

i can at least go ahead.

cheers and happy foxing.

 

boudewijn

Leave a Reply

Your email address will not be published. Required fields are marked *