TreeMenu(root; pagesize::Int=10, dynamic = false, maxsize = pagesize, keypress = (m,i) -> false, kwargs...)

Use root to create an interactive menu using TerminalMenus. pagesize is the number of lines to use for a page. If dynamic, adjust the page size based on the expansion of the content. maxsize is the maximum size of the page.

Provide a function keypress to respond to keys while the menu is shown. The function has two arguments, m::TreeMenu and i::UInt32. The integer i is the key pressed. This function should return true if the menu should exit and false otherwise.

kwargs are passed to TerminalMenus.Config.


Return true if node is the root node (meaning, it has no parent).

newnode, newdepth = next(node, depth::Int=0)

Return the next node in a depth-first search. depth counts the number of levels below the root. The parent is visited before any children.

itr = nodes(node)

Create an iterator itr that will return the nodes, rather than the node data.


julia> foreach(unfold!, nodes(root))

would ensure that each node in the tree is unfolded.

newnode, newdepth = prev(node, depth::Int=0)

Return the previous node in a depth-first search. depth counts the number of levels below the root.

This traverses in the opposite direction as next, so last, deepest children are visited before their parents.

writeoption(buf::IO, data, charsused::Int; width::Int=displaysize(stdout)[2])

Print data to buf as a menu option. charsused is the number of characters already printed on that line. width allows you to specify the display width (in characters), which defaults to the width of the terminal window.

Given a tree built from Node{Data}, packages implementing a TreeMenu may need to implement writeoption(buf, data::Data, charsused).

The implementation for data::AbstractString is careful to ensure that the option does not wrap to a new line of the terminal, and to ensure that any color printing is turned off even when the line has to be truncated.