> Waoooo.... Cool Site indeed !!
>
> Hi,
>
> I have defined a TreeView (SP5) on a Form, also defined a Shortcut Menu, due to the TreeView has no RightClick Method, therefore, I added the code to the MouseDown as follow : -
>
> IF BUTTON = 2
> DO myShortcut.mpr
> ENDIF
>
> It works, but when I RightClick one of the Nodes, then RightClick the other node, the Shortcut can not automatically deactivate, I must (Left) Click one node or some place, the Shortcut then got normal.
>
> How can I solve this or any other way to define RightClick on a TreeView?
>
> Thanks in advance.
>
> Terrence
Hey Terrance,
I don't know about the mpr. I created my shortcut programmatically and it works fine.
try the following basic steps:
1. place this code in the mousedown event of the treelist
if button=2
thisform.dopopup()
endif
2. create a method in the form called dopopup.
3. place this code in the forms new method called dopopup
SET SHADOW ON
DEFINE POPUP treepopup ;
FROM MROW(), MCOL() ;
MARGIN ;
shortcut
DEFINE BAR 1 OF treePopup PROMPT 'Test Right Click Popup'
*** you can define other bars interactively or simply add here
** i have been adding them from a table
ON SELECTION POPUP treepopup _SCREEN.ACTIVEFORM.treepop(BAR())
ACTIVATE POPUP treepopup
RELEASE POPUP treepopup
4. next add another method to the form called treepop
5. last add the following code to the treepop method
LPARAMETERS tnbar
** this case statement can be expanded to do the different functionality of each menu item
do case
case tnbar=1
endcase
DEACTIVATE POPUP gridpopup
Please note that credit is given to the TasTrader Sample in the Visual Foxpro Samples for the basis of this functionality. Code was modified to be used a little more generically.
Paul Culbertson
Houston, TX