Stupid question about treeviewnode

BlitzMax Forums/MaxGUI Module/Stupid question about treeviewnode

hub(Posted 2007) [#1]
i'm debugging a piece of code and not find where is my error. So my stupid question. Is Maxgui change the others nodes value when you delete, insert something ?

in others words in the treeview is the node values are fixed ?

for example :

Node1 = AddTreeViewNode "project 1", projects

next if i work with anothers nodes (delete or insert), are you sure than Node1 have always the same value ?

Many thanks, i know that is a stupid question !


SebHoll(Posted 2007) [#2]
What do you mean by "value"? Do you mean the gadget type reference returned by AddTreeViewNode() or the index of the node?


hub(Posted 2007) [#3]
the gadget type reference at runtime. (not the index of the node)


jsp(Posted 2007) [#4]
Sure, if you save in Node1 the Tgadget returned by AddTreeViewNode it will always stay the same, doesn't matter if you insert or delete something in the treeview.


hub(Posted 2007) [#5]
thanks, in fact i trying to debug this code to swap two node into my game editor.
Don't know why this not works. (have e1 and e2 data swapped, but not works on the treeview ! if i comment the lines

' permutation des noeuds

'e.Noeud = e1. Noeud
'e1.Noeud = e2. Noeud
'e2.Noeud = e. Noeud

it's works ! it's not logic !!! i don't find my mistakes !




jsp(Posted 2007) [#6]
Does this may help


hub(Posted 2007) [#7]
Thanks to share this jsp. I'm using your swapnode function inside my previous code and now it works very well !


hub(Posted 2007) [#8]
into your swap node function what is .context ?


jsp(Posted 2007) [#9]
Oh, the tools are collected/written from Jake not me, so the thanks goes to him :)
The context is a field of the TGadget
Field context:Object

You can use it for your own objects to store. So far MaxGui uses it only itself when a filter is set on a texfield/textarea.
This is extremely useful for storing references, which can be used when a user clicks on a treeview node. Just remember to cast it to your type again.
To set it:
MyNode:TGadget = AddTreeViewNode...
MyNode.Context = “MyNode selected”
to retrieve it:
Temp:TGadget = SelectedTreeViewNode...
Print String(TGadget.Context) 'Prints MyNode selected

String is here just an example, could be of course your own complex type.