Returns true if the column titles are being shown.
Clears the tree. This removes all items.
Creates an item in the tree and adds it as a child of parent. If parent is null, the root item will be the parent, or the new item will be the root itself if the tree is empty. The new item will be the idxth child of parent, or it will be the last child if there are not enough siblings.
Edits the selected tree item as if it was clicked. The item must be set editable with TreeItem.setEditable. Returns true if the item could be edited. Fails if no item is selected.
Makes the currently focused cell visible. This will scroll the tree if necessary. In constant SELECT_ROW mode, this will not do horizontal scrolling, as all the cells in the selected row is focused logically. Note: Despite the name of this method, the focus cursor itself is only visible in constant SELECT_MULTI mode.
Returns the column index at position, or -1 if no item is there.
Returns the column's title.
Returns the column's width in pixels.
Returns the rectangle for custom popups. Helper to create custom cell controls that display a popup. See TreeItem.setCellMode.
Returns the drop section at position, or -100 if no item is there. Values -1, 0, or 1 will be returned for the "above item", "on item", and "below item" drop sections, respectively. See dropmodeflags for a description of each drop section. To get the item which the returned drop section is relative to, use getItemAtPosition.
Returns the currently edited item. Can be used with itemEdited to get the item that was modified.
Returns the column for the currently edited item.
Returns the rectangle area for the specified item. If column is specified, only get the position and size of that column, otherwise get the rectangle containing all columns.
Returns the tree item at the specified position (relative to the tree origin position).
Returns the next selected item after the given one, or null if the end is reached. If from is null, this returns the first selected item.
Returns the last pressed button's index.
Returns the tree's root item, or null if the tree is empty.
Returns the current scrolling position.
Returns the currently focused item, or null if no item is focused. In constant SELECT_ROW and constant SELECT_SINGLE modes, the focused item is same as the selected item. In constant SELECT_MULTI mode, the focused item is the item under the focus cursor, not necessarily selected. To get the currently selected item(s), use getNextSelected.
Returns the currently focused column, or -1 if no column is focused. In constant SELECT_SINGLE mode, the focused column is the selected column. In constant SELECT_ROW mode, the focused column is always 0 if any item is selected. In constant SELECT_MULTI mode, the focused column is the column under the focus cursor, and there are not necessarily any column selected. To tell whether a column of an item is selected, use TreeItem.isSelected.
Causes the Tree to jump to the specified item.
If true, the column will have the "Expand" flag of Control. Columns that have the "Expand" flag will use their "min_width" in a similar fashion to Control.sizeFlagsStretchRatio.
Sets the minimum width of a column. Columns that have the "Expand" flag will use their "min_width" in a similar fashion to Control.sizeFlagsStretchRatio.
Sets the title of a column.
If true, column titles are visible.
If true, the currently selected cell may be selected again.
If true, a right mouse button click can select items.
The number of columns.
The drop mode as an OR combination of flags. See dropmodeflags constants. Once dropping is done, reverts to constant DROP_MODE_DISABLED. Setting this during Control.canDropData is recommended. This controls the drop sections, i.e. the decision and drawing of possible drop locations based on the mouse position.
If true, the folding arrow is hidden.
If true, the tree's root is hidden.
Allows single or multiple selection. See the selectmode constants.
Construct a new instance of Tree. Note: use memnew!Tree instead.
func _ready(): var tree = Tree.new() var root = tree.create_item() tree.set_hide_root(true) var child1 = tree.create_item(root) var child2 = tree.create_item(root) var subchild1 = tree.create_item(child1) subchild1.set_text(0, "Subchild1")
To iterate over all the TreeItem objects in a Tree object, use TreeItem.getNext and TreeItem.getChildren after getting the root through getRoot. You can use GodotObject.free on a TreeItem to remove it from the Tree.
Control to show a tree of items.
This shows a tree of items that can be selected, expanded and collapsed. The tree can have multiple columns with custom controls like text editing, buttons and popups. It can be useful for structured displays and interactions. Trees are built via code, using TreeItem objects to create the structure. They have a single root but multiple roots can be simulated if a dummy hidden root is added.