Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2175
  • Last Modified:

VFP Menu and Tree

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
Nirmal Sharma
Asked:
Nirmal Sharma
  • 4
  • 3
1 Solution
 
Olaf DoschkeSoftware DeveloperCommented:
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
 
Nirmal SharmaSolution ArchitectAuthor Commented:
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
 
Olaf DoschkeSoftware DeveloperCommented:
Are you talking about a context menu? In a treeview control? Please be more specific.

Bye, Olaf.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
Nirmal SharmaSolution ArchitectAuthor Commented:
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
 
Olaf DoschkeSoftware DeveloperCommented:
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
 
Nirmal SharmaSolution ArchitectAuthor Commented:
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
 
Olaf DoschkeSoftware DeveloperCommented:
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 to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now