Questions tagged [treenode]

The base element of a hierarchical tree-like data structure.

Trees are hierarchical data structures that represent undirected acyclic graphs. A tree is therefore composed of connected nodes.

One specific node is the root of the tree. The root node is connected to several nodes (sometimes called children), each of these being the root of a subtree, and so-on. A node of a tree that does not have any children is called a leaf. All nodes of the tree are connected directly or indirectly to the root.

Treenodes are usually recursive datastructures.

See also:

Specific usages:

  • In .Net framework a TreeNode is a node in TreeView UI control that displays tree-like objects.
  • In Java a TreeNode is an interface that nodes of a JTree UI control that displays tree-like objects.
630 questions
0
votes
1 answer

NHibernate - how to map collection of trees

I want map my object model to NHibernate. There is one tricky part in my concept and I don't know if it is possible to do this in NHibernate. I want to have a collection of trees. I have two classes (below, only important properties indicated).…
kuba53280
  • 3
  • 2
0
votes
1 answer

What is the best method to loop through TreeView nodes and retrieve a node based on certain value?

What is the best method to loop through TreeView nodes and retrieve a node based on certain value?
Ahmed Atia
  • 17,848
  • 25
  • 91
  • 133
0
votes
3 answers

Is there anyway to get TreeNode that opened ContextMenuStrip in ToolStripMenuItem click handler?

I have TreeView with different level TreeNodes I added same ContextMenuStrip to all parent TreeNodes and i want to get possibility to delete all child TreeNodes by opening that ContextMenuStrip and pressing "Delete all" private void…
Kosmo零
  • 4,001
  • 9
  • 45
  • 88
0
votes
1 answer

How to make a Traversable Tree Data Structure in C

Does anyone have any good examples of building a tree data structure both iteratively and recursively in C Language (!C++)? Also to traverse through the tree and cover every node.. I'm likely to use this struct: typedef struct treeNode…
ryantata
  • 137
  • 1
  • 3
  • 12
0
votes
3 answers

Can I get the index of an inserted node in a treeview?

In my treeview I want to remember which nodes were expanded and redraw that state after I delete or insert a node. I solved that with remembering the index of an expanded node. If a node is removed, I decrement all indeces that were afterwards. That…
Verena Haunschmid
  • 1,252
  • 15
  • 40
0
votes
2 answers

What field or function i should override to make node have text description in TreeView control when inherit from TreeNode?

I am trying to inherit from TreeNode to add own nodes to TreeView: class TreeViewItem : TreeNode { public new string Text; public override string ToString() { return "asd"; } } I tried that: TreeViewItem tvi = new…
Kosmo零
  • 4,001
  • 9
  • 45
  • 88
0
votes
1 answer

How add TreeNode to TreeNodeCollection with more than name and text in C#

I want to add to my treeview some nodes with childs, but have a problem how to add nodes with for example ToolTipText. I want do it with TreeNodeCollection. It is possible or how could I change my code? Here is my code where all nodes are root…
Norrens
  • 1
  • 3
0
votes
2 answers

Remove/disable child node of a child node from a treeview (VB.NET) (what is wrong with this code?)

I want to remove/disable child nodes after a certain number entered by user in a text box. I know there is something wrong in following code, but I am not able to figure it out (I am a beginner). Dim k As Integer k = Val(TextBox1.Text) For i = k +…
mrn
  • 425
  • 2
  • 15
  • 33
0
votes
1 answer

Treenode to GridView

ExtJS4 I'm trying to move a treenode to gridpanel. I want its associated data to be inserted here. But whenever I move the treenode, it creates an empty row at that position. I've created the tree as: var treeData = { text: 'Business…
Shashwat
  • 2,538
  • 7
  • 37
  • 56
0
votes
1 answer

Java: How to get the index of file in JTree

I have a JTree and I have it displaying everything I need, but i want to add what ever file i choose from the JTree to a JTextArea. I have this been done using a JList which all i do is get the selected index of the file in the JList and then append…
flexinIT
  • 431
  • 2
  • 10
  • 28
0
votes
2 answers

Set value in ArrayList into TreeView

I have two ArrayLists named ProductList and ItemList. ProductList holds two string[] arrays. string[0] string[1] --------- ----------- ProductID ProductName --------- ------------- A001 Food B120 NotFood ItemList holds…
Qusyaire Ezwan
  • 279
  • 4
  • 8
  • 18
0
votes
1 answer

Change parent node checkmark to a box when only some children selected

Possible Duplicate: Tri-State Checkboxes in WinForms TreeView How can I change the symbol within the parent node checkbox in treeview to a green box instead of a checkmark when only some of the children within the parent node are…
Kishen
  • 23
  • 5
0
votes
1 answer

Java: DefaultMutableTreeNode Event When Renamed

I created a class that extends DefaultMutableTreeNode. It has a variable, "resource" of the type Resource so that it can be linked to an object without that object affecting its name. The Resource class has a variable, "name" that I would like to be…
jimn346
  • 113
  • 1
  • 2
  • 9
0
votes
5 answers

Public variable in Recursive function C#

I have a function that is recursive in C# that i want to edit a global variable(i assume it is global due to the public before it) declared outside the function. For some reason that i do not know it cannot see the public variable within that…
Axxelsian
  • 787
  • 3
  • 9
  • 25
0
votes
1 answer

Trouble checking for a valid path (string) being entered into a tree

I've created a TreeNode class which holds an ArrayList of tree nodes (named branch) and I want to add new branches to the tree by user entered paths. An example path being /Monkey/King/Bar where each of those would ideally be an existing branch with…
Vorfall
  • 45
  • 3