Hierarchical Listbox Parent/Child Mgmt Q

Hi all,

I have working code to manage my parent/child relationship within my subclassed hierarchical listbox. I am afraid then strategy I am using by keeping the row numbering scheme within each row’s rowtag fails me when I get past three levels deep.

What is the best way that you have been successful with scaling your parent/child relationship identification?

Thank you in advance!!

You could make a class for keeping track of the relationships and put that in the rowtag.

Thanks Greg. What is the best way to track the relationship?

ie. What do you put in your rowtags info wise?

[quote=137090:@Mike Cotrone]Thanks Greg. What is the best way to track the relationship?

ie. What do you put in your rowtags info wise?[/quote]

Depend how are managing things. For me the parent always knows it’s children so it can recreate them in Expand row.

So either the class holds and array to it’s children or it queries and database to get them.

So I don’t have circular references I also store teh indent level in the class when I add the row… That way by simply climbingthe listbox rows a child can find it’s parent without keeping a reference to it (I started doing that before weak references were added to the language)

Well, you could make a class that has two properties (myRowClass), One for ID and the other for ParentID. Then when creating a row, just create one of these objects:

dim tag as new myRowClass Tag.ID = MakeNewRowTag() Tag.ParentID = myRowClass(me.RowTag(row)).ID Me.AddRow "" Me.RowTag(me.lastindex) = tag
Just make sure you check if the rowtag is Nil before using it.

Thank you both! I appreciate the input. I am pulling a decent amount of JSON info and parsing it into a hierarchy of nested dictionaries and in some cases 9 deep. This is an example of my storage scenario:

ClassArray --> Class that keeps the Entry point dictionary and some other properties --> dictionary (and/or non dictionary info) --> etc…

Thank you for your input and I will work on implementing a version what you guys are recommending.

Thanks!

[quote=137092:@Karen Atkocius]Depend how are managing things. For me the parent always knows it’s children so it can recreate them in Expand row.

So either the class holds and array to it’s children or it queries and database to get them.

So I don’t have circular references I also store teh indent level in the class when I add the row… That way by simply climbingthe listbox rows a child can find it’s parent without keeping a reference to it (I started doing that before weak references were added to the language)[/quote]

Karen I am curious are you using the addfolder for this or using the insertfolder using the indent parameter?
Thanks!

[quote=137098:@Mike Cotrone]Thank you both! I appreciate the input. I am pulling a decent amount of JSON info and parsing it into a hierarchy of nested dictionaries and in some cases 9 deep. This is an example of my storage scenario:

ClassArray --> Class that keeps the Entry point dictionary and some other properties --> dictionary (and/or non dictionary info) --> etc…

Thank you for your input and I will work on implementing a version what you guys are recommending. (How do you retrieve the indent level? :slight_smile: )

Thanks![/quote]

[quote=137209:@Mike Cotrone]Karen I am curious are you using the addfolder for this or using the insertfolder using the indent parameter?
[/quote]

I only use Addfolder (or AddRow) in the ExpandRow event and never use the indent parameter…

Things are simpler that way IMO … and when I first started doing that there was no indent parameter so I had no choice!

  • Karen

[quote=137211:@Karen Atkocius]I only use Addfolder (or AddRow) in the ExpandRow event and never use the indent parameter…

Things are simpler that way IMO … and when I first started doing that there was no indent parameter so I had no choice!

  • Karen[/quote]
    Awesome! Sorry i screwed up a few posts ago by not asking this question. How do you get the indent level? I can’t find any properties that hold this. Thanks again Karen.

I make it part of the class that holds the information about the parent and I assign it only in ExpandRow . (If you do it outside of expand row by definition the indent level would be 0 if you don’t use the indent parameter)

There is a feature request to have the framework take care of it, but if you are using a class stored in the rowtag to deal with the hierarchy putting it there is is simple…

I can explain further if you need me to.

  • Karen

[quote=137218:@Karen Atkocius]I make it part of the class that holds the information about the parent and I assign it only in ExpandRow . (If you do it outside of expand row by definition the indent level would be 0 if you don’t use the indent parameter)

There is a feature request to have the framework take care of it, but if you are using a class stored in the rowtag to deal with the hierarchy putting it there is is simple…

I can explain further if you need me to.

  • Karen[/quote]

Thanks Karen! I appreciate the advice!

[quote=137218:@Karen Atkocius]I make it part of the class that holds the information about the parent and I assign it only in ExpandRow . (If you do it outside of expand row by definition the indent level would be 0 if you don’t use the indent parameter)

There is a feature request to have the framework take care of it, but if you are using a class stored in the rowtag to deal with the hierarchy putting it there is is simple…

I can explain further if you need me to.

  • Karen[/quote]

I guess where I was missing the boat on Greg’s response was that the rowtag is a variant :slight_smile: I didn’t catch on before about storing objects since I am somewhat new to using variants as of late. Thank you again Karen for driving this home for me.

Mike

Does anybody know of any classes that can be used to handle this?