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: 340 # Views: 2 # Ratings: 0
Version: Unknown Category: General VFP Topics
Date: Wednesday, May 23, 2001 2:29:53 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
>
> Hi Terrance...again,
>
> I use the code in a top level form and it works fine. I am suggesting not to use the menu wizard.
>
> I can't help you with information with the menu builder because i don't use it. What functionality does your sc menu have that my method won't work for you.
>
>
> Paul Culbertson
>
> Houston, TX
>


Paul,

I have tried your suggestion, ran the TreeView Form in a Main Top-Level-Form with a coded Shortcut Menu, it's still have problem, the Shortcut can not self deactivate, I have put a WAIT command before the shortcut in order to test it, I found the first Click was function (it WAIT, then shortcut prompted), but thereafter, every click on the nodes seems has no response (because no WAIT command responded), until I clicked some other place outside the nodes then back to normal.

Finally, I don't know why, I defined the TreeView Form as Top-Level-Form, and running in the Main Top-Level-Form, it become normal, works fine.

Normally, I should define that TreeView as 1. In-Top-Level, and running on a 2. Top-Level-Form, Will there be any unpredictable problem if run two Top-Level-Form at the same time?

Thanks a lot.

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