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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ACC97:How to populate a Treeview from a Table

Status
Not open for further replies.

talenx

Programmer
Aug 7, 2001
157
US
Hello, I know that this question has been asked numerous times but I fail to see the relation between populating a treeview control with normalized data in two or more tables.
I seen some cases where the tree view node is populated by a list control and I have seen it created manually where each node is giving a string name.

I think what I will need to do should fairly simple...
The treeview control will only show three node options.

Treeview Layout
-------------------------------------------------------
REGION---primary node
|
MARKET----1st Child Node
|
COUNTY----2nd Child Node


The Geo Tables layout:
------------------------------------------------
REGION [RegionID] [RegionName]

MARKET [RegionID] [MarketID] [MarketName]

COUNTY [RegionID] [MarketID] [CountyID] [CountyName]

Does anybody know I may begin to populate the treeview control with the desired hierarchy?

Thank you very much!!


 
So you need the structure out of a table?

My advise, put an extra number field in your database coding your structure ex
0would be for the strings in the root
1 would be a child of the first node etc.

regards S. van Els
SAvanEls@cq-link.sr
 
Just a little warning. The Delphi TreeView component is a little bit slow.

I suggest that you load the data into the childnodes when the node is expanded...

I tried to load up about 2000 nodes/subnodes in the tree, and when I tested the app on a Celeron machine, it took a while... Andreas Nordlund
Software developer
 
Thanks for the tip... I’ll take it into consideration while trying to tackle this monster.

And thanks for the link, I’ll check it out and see if I can make since of it.

Thanks again
TalenX
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top