TreeView-class: TreeView widget

TreeViewR Documentation

TreeView widget

Description

Shows a tree of tree_node()s. See tree_view().

Super class

Widget -> TreeView

Public fields

paint_states

Cursor and scroll changes only repaint.

focusable

Trees can be focused.

show_root

Show the root node?

guides

Draw guide lines?

Active bindings

root

The root node.

cursor_node

The node under the cursor, or NULL.

visible_count

Number of visible (expanded) lines.

offset

First visible line minus one.

Methods

Public methods

Inherited methods

TreeView$new()

Create a tree view. See tree_view().

Usage
TreeView$new(
  root,
  show_root = TRUE,
  guides = TRUE,
  id = NULL,
  classes = NULL,
  style = NULL,
  disabled = FALSE
)
Arguments
root

The root TreeNode.

show_root, guides

See fields.

id, classes, style, disabled

See Widget.


TreeView$default_style()

The built-in style.

Usage
TreeView$default_style()

TreeView$default_bindings()

Navigation keys.

Usage
TreeView$default_bindings()

TreeView$tree_changed()

Called by nodes when the tree changes.

Usage
TreeView$tree_changed()

TreeView$select()

Move the cursor to a node (expanding its ancestors).

Usage
TreeView$select(node)
Arguments
node

A node of this tree.


TreeView$action_cursor_up()

Move up.

Usage
TreeView$action_cursor_up()

TreeView$action_cursor_down()

Move down.

Usage
TreeView$action_cursor_down()

TreeView$action_page_up()

Move a page up.

Usage
TreeView$action_page_up()

TreeView$action_page_down()

Move a page down.

Usage
TreeView$action_page_down()

TreeView$action_first()

Go to the first node.

Usage
TreeView$action_first()

TreeView$action_last()

Go to the last visible node.

Usage
TreeView$action_last()

TreeView$action_expand_or_child()

Expand, or go to the first child.

Usage
TreeView$action_expand_or_child()

TreeView$action_collapse_or_parent()

Collapse, or go to the parent.

Usage
TreeView$action_collapse_or_parent()

TreeView$action_toggle()

Toggle the cursor node.

Usage
TreeView$action_toggle()

TreeView$action_activate()

Toggle and send "tree.node_activated".

Usage
TreeView$action_activate()

TreeView$on_mouse_down()

Clicking selects; clicking the arrow toggles.

Usage
TreeView$on_mouse_down(event)
Arguments
event

A MouseEvent.


TreeView$on_mouse_scroll()

The wheel scrolls three lines.

Usage
TreeView$on_mouse_scroll(event)
Arguments
event

A MouseEvent.


TreeView$content_width()

Natural width: the widest visible line.

Usage
TreeView$content_width()

TreeView$content_height()

Natural height: visible lines (at most 1000).

Usage
TreeView$content_height(width)
Arguments
width

Content width.


TreeView$paint()

Draw the visible lines.

Usage
TreeView$paint(buffer, area, st)
Arguments
buffer

A ScreenBuffer.

area

Visible part of the region.

st

Computed style.


TreeView$clone()

The objects of this class are cloneable with this method.

Usage
TreeView$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


termr documentation built on Oct. 21, 2026, 5:13 p.m.