Solved

VFP Menu and Tree

Posted on 2010-08-15
7
1,981 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:Nick Sui
  • 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:Nick Sui
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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 35

Author Comment

by:Nick Sui
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:Nick Sui
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Adjust TIME parameter in Visual FoxPro config file 36 155
TSWEB on windows 7 1 1,084
set order of a table by two fields vfp 4 1,354
FoxPro Version 9.0 2 57
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…
A Short Story about the Best File Recovery Software – Acronis True Image 2017
This video discusses moving either the default database or any database to a new volume.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

757 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now