 |
Kiasyn Apprentice

Joined: 05 Dec 2004 Posts: 196 Location: New Zealand
|
Posted: Sun Feb 27, 2005 4:16 am
Getting a Node in a Tree |
Is there a quick way to get a node from a tree? I have a node named Rooms is there any quick way i can get reference to do this? :P
Thanks:X |
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Mar 01, 2005 8:08 am |
Not exactly sure what you are asking. The currently selected node of a tree can be obtained via the Tree.CurrentNode property. If you have an object assigned to this node, you can get access to it via the Data property of the Node. Take a look at the property list for the zTree object. I haven't filled in a lot of details yet, but at least you'll see the various property and method names for the Tree component.
|
|
|
 |
Kiasyn Apprentice

Joined: 05 Dec 2004 Posts: 196 Location: New Zealand
|
Posted: Tue Mar 01, 2005 8:50 am |
Example tree thingie
Code: |
Node 1
... Node A
... Node B
Node 2
... Node C
... Node D
Node 3
... Node E
... Node F |
Say I wanted to add another node to the thingie of node 2, how would i do this? |
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Mar 01, 2005 7:40 pm |
Ahh, OK, I see...
Well, the "Find" method isn't implemented yet. It has to do some fancy stuff to locate a node anywhere in the tree, and I want it to be compatible with XML tree stuff.
And I also notice that I haven't even documented the properties and methods for the zNode object, nor are any of the zNode methods currently exported.
So, right now the only way to do this is if you kept the object link to Node 2 when it was originally added to the tree, which you probably didn't.
Let's see...hmm...one thing you might try is this:
set N = core.FindControl( "Node 2")
and see if you get anything with that. I don't remember if nodes are entered into the global namespace for zApp or not. If they are, then this should find them. Then you can use the statement:
set NewNode = Tree.AddChild( N, "Node G")
to add a new node to the one that you found above. |
|
|
 |
Kiasyn Apprentice

Joined: 05 Dec 2004 Posts: 196 Location: New Zealand
|
Posted: Wed Mar 02, 2005 2:07 am |
Object required: 'core.FindControl(...)'
=X
Thanks for your help with this... *thinks* :P |
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Mar 02, 2005 6:50 am |
Once I get the new DevExpress Tree component integrated, I'll be adding all of the methods that you need for this. So, it should be better in a week or two. Sorry for the trouble.
|
|
|
 |
Kiasyn Apprentice

Joined: 05 Dec 2004 Posts: 196 Location: New Zealand
|
Posted: Wed Mar 02, 2005 11:19 am |
That's awesome :D
|
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Fri Mar 25, 2005 12:11 am |
I've added the documentation that I promised for zTree and zNode. In the current CVS build you can now search for nodes. To answer your original question, here is how you'd do it.
Code: |
Set Node = Tree.Find( "Node 2")
Node.AddChild( "New Node") |
There is both a zTree.Find and zTree.FindText function. The first one searches based upon the variant data that you used when creating a node, while the second searches purely on the displayed text.
The only thing in the documentation that isn't implemented in the current build is the ability to add <NODE> tags within the <TREE> tag to create the tree structure at design-time. That ability will be in the next build. |
|
|
 |
Kiasyn Apprentice

Joined: 05 Dec 2004 Posts: 196 Location: New Zealand
|
Posted: Fri Mar 25, 2005 10:51 am |
YAY! :P Now i have to convince someone to buy zApp for me... XD
|
|
|
 |
|
|