Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tree View

Status
Not open for further replies.

alisaif

ISP
Apr 6, 2013
418
AE
Hi,

I want to generate a tree view for my main menu screen (mainmenu.scx) using table which contains the heads as follows. I would appreciate if someone worked on it and can share it to me.

Sales
-----
1. Sales Order
2. Despatched Order
3. Delivery Challan
..
..
..

Purchase
--------
1. Purchase order
2. Purchase Invoice
..
..

Accounts
--------
..
..

Reports
-------

etc.

Thanks

Saif
 
Thanks for the reply!

It is like the following:

1. MainCat c(25)
2. Category c(25)
3. Subcat1 c(25)
4. Subcat2 c(25)
5. Desc c(50)

In MainCat (Sales, Purchase, Accounts, ... Reports)
In Category (Sales Order, Despatch Order, Delivery Challan, ..., ..., Sales Return)
In SubCat1 (..., ..., Sales Invoice Direct, Sales Invoice Through Delivery Challan, ..., ..., )
In SubCat2 (...,...,) etc.

Thanks

Saif
 
Saif,

How exactly would you like us to help you? And how much do you know already?

Have you already written some code, but are having trouble getting it to work? Or do you not know how to get started? I'm not sure we'd be able to actually write your code for you, but if you have any specific questions, that's another matter.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Why?

This structure doesn't give any connection between main and subcategory, despite being in the same record.

Put it in this structure:

id, parentid, category, description

For root/main categories parentid is NULL, otherwise it's the ID of the parent category.

Restructuring your data this way it's easy to use sample code to populate Treeviews, eg this way:
Code:
SELECT CATEGORIES
SCAN 
   Treeview.Nodes.Add(str(parentid),,str(id),category)
ENDSCAN

The right table schema makes it easy to populate the tree, don't you agree?

Bye, Olaf.

 
Actually, I am totally unaware of treeview concept. I want step by step instructions.

Saif
 
I want step by step instructions.

It's not the job of the forum to write your code for you - especially as the treeview is quite a bit more complicated than, say, a grid or a combo box.

There are many places on the web where you can find sample code, which you can adapt for your own needs. Here are some places where you might start:

(also has references to a couple of tutorials)


Also, Doug Hennig has a very useful paper called "Creating Explorer Interfaces in Visual FoxPro", which gives a lot of information about the Treeview. See
Once you've got started, feel fee to come back if you have some specific questions or problems.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Thanks I will go through this useful sites.

Saif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top