Notifications
Clear all
[Closed] DotNet Treenode.tag Property?
Feb 02, 2011 12:41 am
Hello,
Can anybody explain how to use the .tag property of a treenode.
Thanks
Sumesh
3 Replies
Feb 02, 2011 12:41 am
Hello Sumesh,
the .tag-property can be used as a container for all kinds of data. You can store for instance a struct with data related to the treenode. The way I do this goes as follows:
struct vehicleStruct --this struct stores info about a car
(
model = "Large", size = 10, passengers = 3
)
theNode = dotnetObject "treenode" --create a new treenode
theNode.tag = dotNetMxsValue (vehicleStruct())--add the struct to the treenode, in the tag-property
In this example a struct is added to the tag of a treenode. This uses the "dotNetMxsValue" method. If you want to add more common valuetypes such as strings or integers, you can just assign them to the tag without this method. If you want to retrieve that struct back from the treenode you do as follows:
theStruct = theNode.tag.value
Hope this helps,
Klaas
Feb 02, 2011 12:41 am
Thanks Klaas,
That gave me an idea on what it is. I will be trying it out today.
Thanks for the detailed explanation again.
Sumesh