Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Terrence Ho
  Where is Terrence Ho?
 Hong Kong
 Hong Kong
 Terrence Ho
 To: Paul Culbertson
  Where is Paul Culbertson?
 Katy
 Texas - United States
 Paul Culbertson
 Tags
Subject: RE: Shortcut Menu RightClick on a TreeView Problem
Thread ID: 310 Message ID: 313 # Views: 2 # Ratings: 0
Version: Unknown Category: General VFP Topics
Date: Tuesday, May 22, 2001 2:47:29 PM         
   


> > 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
>


Thanks Paul,

It works fine if the Form run on the VFP Command Window, but the problem happened when the Form run inside a Top-Level-Form. And my Shortcut is defined by VFP Menu Wizard.

Terrence

ENTIRE THREAD

Shortcut Menu RightClick on a TreeView Problem Posted by Terrence Ho @ 5/22/2001 1:49:32 PM
RE: Shortcut Menu RightClick on a TreeView Problem Posted by Paul Culbertson @ 5/22/2001 2:10:08 PM
RE: Shortcut Menu RightClick on a TreeView Problem Posted by Terrence Ho @ 5/22/2001 2:47:29 PM
RE: Shortcut Menu RightClick on a TreeView Problem Posted by Paul Culbertson @ 5/22/2001 4:47:32 PM
RE: Shortcut Menu RightClick on a TreeView Problem Posted by Terrence Ho @ 5/23/2001 2:29:53 PM
RE: Shortcut Menu RightClick on a TreeView Problem Posted by Paul Culbertson @ 5/23/2001 3:56:23 PM
RE: Shortcut Menu RightClick on a TreeView Problem Posted by Terrence Ho @ 5/24/2001 11:16:49 AM