Why does this fail?

Discussion and support relating to Data Tree

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Locked
danFriedman
Posts: 11
Joined: Wed Sep 29, 2010 4:26 pm

Why does this fail?

Post by danFriedman » Wed Sep 29, 2010 4:40 pm

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

danFriedman
Posts: 11
Joined: Wed Sep 29, 2010 4:26 pm

Re: Why does this fail?

Post by danFriedman » Wed Sep 29, 2010 9:15 pm

I found the problem. I wasn't setting the dt_general["root nodes"] property to the list of roots. Problem resolved.

worcestersource
Posts: 24
Joined: Wed Mar 17, 2010 3:51 pm
Location: Worcester, UK
Contact:

Re: Why does this fail?

Post by worcestersource » Wed Sep 29, 2010 9:26 pm

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):

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
And then at the bottom:

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")
   
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

danFriedman
Posts: 11
Joined: Wed Sep 29, 2010 4:26 pm

Re: Why does this fail?

Post by danFriedman » Wed Sep 29, 2010 10:47 pm

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

worcestersource
Posts: 24
Joined: Wed Mar 17, 2010 3:51 pm
Location: Worcester, UK
Contact:

Re: Why does this fail?

Post by worcestersource » Wed Sep 29, 2010 10:58 pm

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

danFriedman
Posts: 11
Joined: Wed Sep 29, 2010 4:26 pm

Re: Why does this fail?

Post by danFriedman » Wed Sep 29, 2010 11:12 pm

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

worcestersource
Posts: 24
Joined: Wed Mar 17, 2010 3:51 pm
Location: Worcester, UK
Contact:

Re: Why does this fail?

Post by worcestersource » Wed Sep 29, 2010 11:15 pm

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

Locked

Return to “Data Tree”