Solved

VFP Menu and Tree

Posted on 2010-08-15
7
2,038 Views
Last Modified: 2012-05-10
Hi All,

I'm in process of doing a final minute change to my project. Due to complexity of the menu/sub-menus, I would need to know if it is possible to create a Tree for the menus/submenus?

As an example:

   Menu1
      Submenu1
      SubMenu2
   Menu2
      SubMenu1
      SubMenu2

I can import the menus/submenus in a table and then create a Tree View but question is how?

Thanks in advance!
SP

     
0
Comment
Question by:Nirmal Sharma
  • 4
  • 3
7 Comments
 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 33440717
Menu generator: generate a submenu, generate an item within the submenu ans choose it to be a submenu. You can nest this as often as you like and need.

Treeview control: You can use MS treeview ActiveX control ond others: http://fox.wikis.com/wc.dll?Wiki~TreeView

Bye, Olaf.
0
 
LVL 35

Author Comment

by:Nirmal Sharma
ID: 33441168
I have gone through the above example but it doesn't elaborate more on executing a procedure or command on selection of submenu in a tree.

Can you please give a working example on how to create a menu from records in a table and it should be tree?

Thanks!
SP
0
 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 33441859
Are you talking about a context menu? In a treeview control? Please be more specific.

Bye, Olaf.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 35

Author Comment

by:Nirmal Sharma
ID: 33448245
Yes, that's what I'm after. A Table with the following data in it:

   Field1     Field2     Tag
   Dep1      Data1     D1
   Dep1      Data2     D1
   Dep2      Data1     D2
   Dep2      Data2     D2

Hence, there are two menus (Dep1 and Dep2 and submenu are Data1 and Data2 for each menu)

How would I show them in a TreeView and on selection of Data1 or Data2 a command or procedure should run?

Thanks!
SP
0
 
LVL 29

Accepted Solution

by:
Olaf Doschke earned 500 total points
ID: 33457899
A menu is a menu and a treeview is a treeview. Okay, so you want to use a treeview as a menu.

DO HOME(2) + '\Solution\Solution.App'
expand the root node "ActiveX"
expand the node "ActiveX controls"
double click on "Add and remove items in a treeview control"

In fact you now already used what you want: a menu in the form of a treeview control which calls something on a doubleclick. The solution.app source code is included in foxpro.

But aside of that the sample you started now has a button "Load DBF" click it and then choose the "solution.dbf" from the file open dialog. OK. Now here you are, the sample displays the same treeview as the solution.app itself does.

Now Close, then in solution.app click on "See Code". Now you can see the code behind the treeview sample.

Bye, Olaf.
0
 
LVL 35

Author Closing Comment

by:Nirmal Sharma
ID: 33465783
Excellent!!!
Thanks for the suggestions!

When I click on See Code it shows me the Form and properties, etc.. Is there any way to actually look at the Code (I meant PRG file)?

Thanks!
SP
0
 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 33550259
This is the code. click on a button and you get to the (method) editor showing you the click event etc. You can take a look at the whole code, if you open the form in the class browse and use the viewcode button from the toolbar, but the code is rather for an overview. You could also set a breakpoint at some click to see what happens by debugging and singlestep through the code.

Bye, Olaf.
0

Featured Post

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime is disastrous for companies and can lead to major hits on a brand, reputation, an…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question