GUITree

From Virtual World Web Wiki
Jump to: navigation, search

A UI component representing a hierarchical tree of nodes (like in File Explorers)

  • Inherits class: GUIScrollBox
  • This is a JavaScript visible object

Remarks [edit]

Properties

bool AllowDeselect {get; set;}
Allow the user to deselect all tree nodes
bool AutoCollapse {get; set;}
Auto collapse child nodes when a node gets deselected
bool AutoExpand {get; set;}
Auto expand child nodes when a node gets selected
int ChildCount {get;}
How many root nodes does this tree have?
bool MultiSelect {get; set;}
Allow multiple tree nodes to be selected at the same time
GUITreeNode SelectedNode {get;}
Most recently selected node
int SelectedNodeCount {get;}
Number of selected nodes
string TreeNodeTemplate {get; set;}
What template to use when creating new tree nodes.

Events

OnDeselect()
Event fired when a node is deselected
OnInvalidate(EventHandler<FlexibleEventArgs<GUITreeNode>>)
Parameters:
node : The node being invalidated
Event fired when a node in this tree is invalidated and in need of refresh
OnKeyDown()
Event fired when a key is pressed while the tree has focus
OnKeyUp()
Event fired when a key is released while the tree has focus
OnSelect()
Event fired when a new node is selected
OnTreeChange()
Event fired when a node is added or removed from the tree

Methods

GUITreeNode AddNode(string label, string template = NULL)
Adds a new root node to the tree
void AutoScroll()
void Clear()
Removes all the nodes in the tree
void ClearSelection()
Clear all selections on the tree
void CreateFromJSON(int parent, string json, string template = NULL)
Creates a tree based on a JSON representation underneath a given parent node.
bool DeselectNode(GUITreeNode node)
Removes a given node from the selection list
GUITreeNode FindChildByID(int id)
Given a TreeNodeID finds the matching tree node
GUITreeNode FindNode(string nodeName)
GUITreeNode FirstChild()
Get the first root node in the tree
GUITreeNode GetChild(int index)
Gets the root node with a given index
GUITreeNode[] GetChildNodes()
Gets all root nodes of this tree
List<GUITreeNode> GetSelectedNodes()
Gets a list of all the selected nodes of the tree.
IEnumerable<GUITreeNode> GetSubNodes(bool visibleOnly = false)
Gets an array of all nodes in the tree
void Invalidate()
Trigger the OnInvalidate event for every node
GUITreeNode LastChild()
Get the final root node in the tree
void RemoveByID(int node)
Removes a node from the tree by ID
bool SelectNode(GUITreeNode node, bool addSelection = false)
Adds a given node to the selection list
string ToString()
Exports the tree structure as a JSON serialized string