TreeView ActiveX Control to hide/unhide nodes

TreeView ActiveX Control to hide/unhide nodes

cthomas
Explorer Explorer
282 Views
1 Reply
Message 1 of 2

TreeView ActiveX Control to hide/unhide nodes

cthomas
Explorer
Explorer
I need some help in using the TreeView ActiveX Controls to find children of parent nodes. I used the help doc that ships with max "How to develop a Scene Browser using TreeView ActiveX Control" for the basis of my script. The script uses treeView to check on/off the .isHidden state of parent nodes and hopefully the children and sub children.

Right now it works for parent nodes fine, but I need help having it automatically check on/off the entire heirarchy from the parent down. Can anyone help in the code to cycle through the entire parent.child path in treeView?

Section of code that I need help in:

on tv NodeCheck theNode do
(
theSceneNode = (getNodeByName theNode.text)
if theSceneNode != undefined do
(
theSceneNode.isHidden = not theNode.checked
for c=1 to theNode.children do
(
theNode.child.firstSibling.checked=theNode.checked
theNode.child.lastSibling.checked=theNode.checked
theNode.child.next.checked=theNode.checked -- Note This works for a forced method.
--Append a "next." before theNode.child checked will check the next child node.
--I need this to cycle through the children and grand-children regardless of the count.
-- evaluate ("theNode.child.next.checked=theNode.checked") doesn't seem to work
-- where I can append the "next." to the string and then evaluate.
)
)

Any help would be greatly appreciated.
CT
0 Likes
283 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Question:

What is controlling what here? When you change the checkbox in the parent node, the code changes the hidden flag of the corresponding scene node. For the children though, there can be multiple approaches:

- you can change the checkboxes in the TreeView and then force the scene nodes to be updated based on the TreeView checked states,
- you can change the scene nodes and then update the TreeView to match their hidden states
- you can process the treeVIew children nodes and the scene children nodes separately without any actual synching - the result should be the same.

So which one of these do you have a problem with?

I would go the third way as we can assume that the treeview is a 1:1 mirror of the scene hierarchy, so all you need to do is recursively run through all children of the parent node in the scene and then do the same for the TreeView nodes.
0 Likes