PDA

View Full Version : Checked alls or unchecked alls checkboxes of a tree


rotac
06-05-2006, 12:46 PM
Hello,

Y have a tree, and y want to set alls checkBoxes true with a button and false with other button

(Checked or unchecked alls checkboxes of my tree with a button)

Sorry but my english speaking is bad.

Thx

Rotac

Josué Alba
06-05-2006, 02:59 PM
can you opload a simple example of the tree?

rotac
06-05-2006, 03:25 PM
it's a tree very simple, without subitem, but with 10 nodes.
Name Tree: "tree1"
Node index: "1", "2", "3", ....

Thx

Rotac

TJS
06-05-2006, 04:15 PM
Here is how you would check all nodes off node 1 of a tree object. If you want to add subnodes a little more code will be required.


str_TreeName = "Tree1";
tbl_NodeProps = {};
tbl_NodeProps.Checked = true;

-- Get the number of nodes off of node 1 of the tree
num_ChildCount = Tree.GetChildCount(str_TreeName, "1");

-- Step through each of the nodes and set the checked property to true
for num_Index = 1, num_ChildCount do
Tree.SetNode(str_TreeName, "1." .. num_Index, tbl_NodeProps);
end

rotac
06-06-2006, 03:39 AM
Thank you TJS, but, I don't think that your code is what I want :rolleyes

You can look at the attachement file for an example.

THx

Rotac

rhosk
06-06-2006, 05:31 AM
rotac, upload an exported sample of your project ... you may get more help :D Can't manipulate a Word Doc.

TJS
06-06-2006, 08:01 AM
Hello,

Y have a tree, and y want to set alls checkBoxes true with a button and false with other button

(Checked or unchecked alls checkboxes of my tree with a button)

Sorry but my english speaking is bad.

Thx

Rotac

Sorry if I have misinterpreted your request rotac. My understanding was that you wanted to have a button that when pressed, checks all of the boxes in a tree. The code sample provided above does that when placed in the 'On Click' event of any button that is on the same page as the tree object. To uncheck, just change the tbl_NodeProps.Checked = false and paste the code into the 'On Click' event of another button (of you could set this up so that one button toggles check/uncheck).

EDIT: I just checked your word doc and will post adjusted code shortly...

TJS
06-06-2006, 08:20 AM
Attached is and example of what you have described in you word doc. Download and preview to see how it works. Most of the code is in the Global Functions so you can reuse it across pages.

Hope this helps...

rotac
06-06-2006, 11:16 AM
Thank you very much TJS. :yes :lol

Its exactly that y want...

:yes :lol :yes :lol :yes :lol