[Closed] Possible to make listboxes in listboxes?
It’s the same as adding a node to the treeview, node.nodes.add. So for example for the subanims it would be:
try(destroyDialog subAnimsInspector) catch()
clearlistener()
rollout subAnimsInspector "Find SubAnims with denisT" width:256 height:552
(
dotNetControl tv "TreeView" pos:[4,8] width:244 height:488
button search_bt "Add" pos:[8,504] width:240 height:21
button btn2 "Sub" pos:[8,528] width:240 height:21
local treeNode = dotNetClass "System.Windows.Forms.TreeNode"
fn getSubAnimTree obj prevNode =
(
for i = 1 to obj.numSubs do
(
nextNode = dotNetObject treeNode (getSubAnimName obj i as string)
nextNode.Tag = dotNetMXSValue obj[i]
prevNode.Nodes.Add nextNode
getSubAnimTree obj[i] nextNode
)
prevNode
)
on subAnimsInspector open do
(
local obj = selection[1]
if NOT isValidNode obj do
return messageBox "Invalid selection"
local topNode = dotNetObject treeNode obj.name
topNode.Tag = dotNetMXSValue obj
tv.Nodes.Add (getSubAnimTree obj topNode)
tv.ExpandAll()
)
)
createDialog subAnimsInspector
Thanks sword slayer that was really helpful. After a few days of research I finally learned a few things about TreeNodes. “This website helped ALLOT”
http://www.scriptspot.com/bobo/mxs9/dotNet/DotNetControls.html
I might need some more advice in the future because dotnet is all new to me but so far its all going smoothly.
*Edit I have a question “this would be the last thing to complete my script”. I finished everything “thanks again everyone” and now im down to creating the save and load function for my script. Is there a way to print the child count a parent has and the names of the children?
sorry for bump I just need help in this last thing, maybe I should have been more specific in my question I realize that its not very descriptive.
OK before I show code my tree node doesn’t go past 1 node so I got parent then children not children of children so it kinda makes this a bit easier basically I’m trying to print the parents and children in order.
ParentNode_Array is the array of first nodes in the root of the treeview.
on SaveBS pressed do(
for a=1 to ParentNode_Array.count do(
print ParentNode_Array[a].text
)
)
I need to figure out who to print the amount of children “ParentNode_Array” has per parent.
I need my final script to look like this
on SaveBS pressed do(
for a=1 to ParentNode_Array.count do(
print ParentNode_Array[a].text
for b=1 to ParentNode_Array.children.count do(
)
)
)
Obviously “ParentNode_Array.children.count” is wrong I just want to know the argument for treenode to figure out how many children each parent has.
*EDIT I actually figured it out LOL its as follows
on SaveBS pressed do(
for a=1 to ParentNode_Array.count do(
print ParentNode_Array[a].text
b=ParentNode_Array[a].GetNodeCount(true)
for c=1 to b do(
)
)
)
If you add an ID to it and print the ID you will see the children count of each parent if you have similar code
Lastly I realized that I now have no idea how im going to print the names of the children. Does anyone have ideas?
*EDIT HAHA I also figured this one out and it was NOT easy here is what was supposed to be added in that empty loop
print tv.nodes.item[a-1].nodes.item[c-1].text
this prints out each child in order just in case if anyone needs this in the future ill post updates here if there is any bugs.