Why does this fail?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 11
- Joined: Wed Sep 29, 2010 4:26 pm
Why does this fail?
Hey,
I am trying to implement the Data Tree using a tab-delimitated text chunk. I will be loading many trees like this. But, I never know how many items will be in the tree. Nor will I know how many nested levels there will be. From what I can tell, it looks like the array is correct, but it's not displaying anything! Can someone take a look at this stack and see what I am doing wrong?
http://thenuts.us/treeTest.rev
Many thanks!
-Dan
I am trying to implement the Data Tree using a tab-delimitated text chunk. I will be loading many trees like this. But, I never know how many items will be in the tree. Nor will I know how many nested levels there will be. From what I can tell, it looks like the array is correct, but it's not displaying anything! Can someone take a look at this stack and see what I am doing wrong?
http://thenuts.us/treeTest.rev
Many thanks!
-Dan
-
- Posts: 11
- Joined: Wed Sep 29, 2010 4:26 pm
Re: Why does this fail?
I found the problem. I wasn't setting the dt_general["root nodes"] property to the list of roots. Problem resolved.
-
- Posts: 24
- Joined: Wed Mar 17, 2010 3:51 pm
- Location: Worcester, UK
- Contact:
Re: Why does this fail?
Hi Dan,
Was just in the middle of answering your question but you've beaten me to it!
If it helps, I'd tweak your code as follows (you'll recognise where this goes by the other statements I've left around it):
And then at the bottom:
Hopefully, that should make sense. By the way, the code that takes the tab list and turns it into an array is really clever!
Steve
http://www.theworcestersource.com
Was just in the middle of answering your question but you've beaten me to it!
If it helps, I'd tweak your code as follows (you'll recognise where this goes by the other statements I've left around it):
Code: Select all
if thisID = "" or the number of chars in thisID < 3 then next repeat
put getLevel(tline) into tLevel
if tLevel = 1 then
put thisId into item (number of items of tRootNodes) + 1 of tRootNodes
end if
put getOwner(i,tLevel,standardsData) into tOwner
Code: Select all
set the dt_general["root nodes"] of group "standardsList" to tRootNodes
set the dt_general["node data"] of group "standardsList" to sArray
dt_paint (id of group "standardsList")
![Smile :)](./images/smilies/icon_smile.gif)
Steve
http://www.theworcestersource.com
-
- Posts: 11
- Joined: Wed Sep 29, 2010 4:26 pm
Re: Why does this fail?
Thanks Steve! Data Tree is a nice little tool - I'm glad I bought it. It is quite helpful and it's loading is quite fast (when you fill the array yourself). Only thing I wish is that I could modify the indent of folders. I have some that have the triangle (to open/close) and others that don't. I don't see a way to lineup the folder icons. But, it's not that big of a deal.
Thanks for the help!
-Dan
Thanks for the help!
-Dan
-
- Posts: 24
- Joined: Wed Mar 17, 2010 3:51 pm
- Location: Worcester, UK
- Contact:
Re: Why does this fail?
No worries! Glad I could help.
You can actually override the automatic indentation by using the "indent" node property. As your code works out the indent level, why not try setting this node property to that value?
Cheers,
Steve
http://www.theworcestersource.com
You can actually override the automatic indentation by using the "indent" node property. As your code works out the indent level, why not try setting this node property to that value?
Cheers,
Steve
http://www.theworcestersource.com
-
- Posts: 11
- Joined: Wed Sep 29, 2010 4:26 pm
Re: Why does this fail?
I did...
put "7" into sArray[folderID]["indent"]
But, this isn't working if the item is a "root node". It works fine on everything else... just not on a root.
-Dan
put "7" into sArray[folderID]["indent"]
But, this isn't working if the item is a "root node". It works fine on everything else... just not on a root.
-Dan
-
- Posts: 24
- Joined: Wed Mar 17, 2010 3:51 pm
- Location: Worcester, UK
- Contact:
Re: Why does this fail?
Ahh, I see.
By their very nature, a root node is drawn at the root level of the tree i.e. with no indentation.
Maybe I'll extend this node property to cover root nodes in version two.
Cheers,
Steve
www.theworcestersource.com
By their very nature, a root node is drawn at the root level of the tree i.e. with no indentation.
Maybe I'll extend this node property to cover root nodes in version two.
Cheers,
Steve
www.theworcestersource.com