[maxGUI] treeview.setTarget?

BlitzMax Forums/BlitzMax Beginners Area/[maxGUI] treeview.setTarget?

kimgar(Posted 2007) [#1]
i'm having great troubles finding any documentation about TGadget regarding treeview especially. there are several threads here referring to .kids, .sibly, .name, .context etc. but what else is there?

i have a 3d model that is built up from a folder structure, i also have a treeview that is built from that same structure. now i need a 2-way communication between the two, so that the treeview reflects what is selected in the model and vice versa.

i think managing the 3d model through the treeview is pretty straightforward, but i'm having problems the other way around, as i am unable to find an index or a way to directly target a specific node to set as selected in the treeview.

i've had *some* success with adding .kid nodes as pointers in a list, and then using the list to target the treeview, but i am pretty new to bMax and have a feeling that as my structure grows, i am going to have a hard time managing all the lists of kids and parents - not to mention the .kids.kids.kids

do i have to manage a lot of complex lists to do such a seemingly simple task as treeview.setSelected(index), or is there another way?


skidracer(Posted 2007) [#2]
i think managing the 3d model through the treeview is pretty straightforward, but i'm having problems the other way around, as i am unable to find an index or a way to directly target a specific node to set as selected in the treeview.


AddTreeViewNode returns a handle to a node gadget which you can store in the model hierachy for use later by the model as a parameter to the SelectTreeViewNode command.

If your model data format does not have the ability to store extra things (such as corresponding node gadgets) at runtime you can also create a map that maps model parts to node gadgets:


' create a model to node map

Global modelnodes:TMap=CreateMap()

' add a model to nodegadget mapping

MapInsert modelnodes,modelpart,node

' and later retrieve matching node for modelpart

node=TGadget(MapValueForKey(modelpart))



kimgar(Posted 2007) [#3]
ding! lights on! :)

ofcourse! each 3d model is already wrapped in a type, so i could just store the handle to the proper treeViewNode in that type...i think...
i am still trying to get my head around OOP, but what you are saying makes perfect sense, at least at the moment...

TMap? that one is new - so much to learn :)

it's getting real late, gonna try this out first thing in the morning - skidracer, you've made my day, thank you!