NAME
  Tree - Tree widget

CREATION
  Tree pathName ?option value...?

STANDARD OPTIONS

  -background or -bg | -borderwidth or -bd
  -cursor
  | -highlightbackground -highlightcolor
  | -highlightthickness -relief
  | -selectbackground -selectforeground
  | -takefocus -xscrollcommand
  | -yscrollcommand

WIDGET-SPECIFIC OPTIONS

  -closecmd
  | -deltax -deltay
  | -dragenabled -dragendcmd
  | -dragevent -draginitcmd
  | -dragtype -dropcmd
  | -dropenabled -dropovercmd
  | -dropovermode -droptypes
  | -height -linesfill
  | -linestipple -opencmd
  | -padx -redraw
  | -showlines -width

WIDGET COMMAND
  pathName bindImage event script
  pathName bindText event script
  pathName cget option
  pathName closetree node
  pathName configure ?option? ?value option value ...?
  pathName delete ?arg...?
  pathName edit node text ?verifycmd? ?clickres? ?select?
  pathName exists node
  pathName index node
  pathName insert index parent node ?option value...?
  pathName itemcget node option
  pathName itemconfigure node ?option? ?value option value ...?
  pathName move parent node index
  pathName nodes node
  pathName opentree node
  pathName parent node
  pathName reorder node neworder
  pathName see node
  pathName selection cmd ?arg...?
  pathName visible node
  pathName xview ?arg...?
  pathName yview ?arg...?

DESCRIPTION

Tree widget uses canvas to display a hierarchical list of items (called nodes). Each node is composed of a label with its own font and foreground attributes, and an optional image or window. Each node can have a list of subnodes, which can be collapsed or expanded. Each node is drawn in a single line, whose height is defined by the deltay option, so they must have at most this height. A node is uniquely identified by a string given at creation (by the insert command). The node named root is the root of the tree and is not drawn. The tree structure is directly maintained by the widget.

WIDGET-SPECIFIC OPTIONS

-closecmd
  Specifies a command to be called when user close a node. The closed node is appended to the command.

-deltax
  Specifies horizontal indentation between a node and its children.

-deltay
  Specifies vertical size of the nodes.

-dragenabled
  A boolean specifying if drag is enabled.

-dragendcmd
  Specifies a command to be called when drag ended. dragendcmd must be a command conforming to the description of the option dragendcmd of DragSite::register.

-dragevent
  Specifies the number of the mouse button associated to the drag. Must be 1, 2 or 3.

-draginitcmd
  Tree has a command wrapper for drag-init events. This command refused the drag if no node is designated. In other cases:
  If draginitcmd is empty, it returns:
  - the value of option dragtype or TREE_NODE if empty as the data type,
  - {copy move link} as the operations,
  - the node identifier as the data.
  If draginitcmd is not empty, it is called with the following arguments:
  - the pathname of the tree,
  - the identifier of the dragged node,
  - the toplevel created to represent dragged data.
  and must return a value conforming to draginitcmd option described in DragSite::register.

-dragtype
  Specifies an alternate type of dragged object.

-dropcmd
  Tree has a command wrapper for drop events. This command stops auto scrolling and extract node and position.
  If dropcmd is not empty, it is called with the following arguments:
  - the pathname of the tree,
  - the pathname of the drag source,
  - a list describing where the drop occurs. It can be:
    - {widget},
    - {node node} or
    - {position node index}.
  - the current operation,
  - the data type,
  - the data.

-dropenabled
  A boolean specifying if drop is enabled.

-dropovercmd
  Tree has a command wrapper for drag-over events. This command enables auto scrolling and position extraction during the drag-over. If dropovercmd is not empty, the command is called with the following aguments:
  - the pathname of the tree,
  - the pathname of the drag source,
  - a list describing where the drop can occur, whose elements are:
    - the string widget if dropovertype option contains w, else empty string.
    - the targeted node if drag icon points a node and dropovertype option contains n, else empty string.
    - a list containing a node and the position within the children of the node where drag icon points to if dropovertype option contains p, else empty string.
    - optionally, the preferred method if drop can occur both inside a node and between two nodes. The value is position or node.
  - the current operation,
  - the data type,
  - the data.
  The command must return a list with two elements:
  - the drop status, conforming to those described in dropovercmd option of DropSite::register,
  - the choosen method: widget, node or position.

-dropovermode
  Specifies the type of drop-over interaction. Must be a combination of w, which specifies that drop can occurs everywhere on widget, p, which specifies that drop can occurs between two nodes, and n, which specifies that drop occurs inside nodes.

-droptypes
  Specifies a list of accepted dropped object/operation. See option droptypes of DropSite::register. for more infromation.
  Default is TREE_NODE with operations copy and move.

-height
  Specifies the desired height for the tree in units of deltay pixels.

-linesfill
  Specifies a foreground color for the lines between nodes.

-linestipple
  Specifies a stipple bitmap for the lines between nodes.

-opencmd
  Specifies a command to be called when user open a node. The opened node is appended to the command.

-padx
  Specifies distance between image or window and text of the nodes.

-redraw
  Specifies wether or not the tree should be redrawn when entering idle. Set it to false if you call update while modifying the tree.

-showlines
  Specifies whether or not lines should be drawn between nodes.

-width
  Specifies the desired width for the tree in units of 8 pixels.

WIDGET COMMAND

pathName bindImage event script
  This command associates a command to execute whenever the event sequence given by event occurs on the image of a node. The node idenfier on which the event occurs is appended to the command.

pathName bindText event script
  This command associates a command to execute whenever the event sequence given by event occurs on the label of a node. The node idenfier on which the event occurs is appended to the command.

pathName cget option
  Returns the current value of the configuration option given by option. Option may have any of the values accepted by the creation command.

pathName closetree node
  This command close all the subtree given by node (recurse through the tree starting at node and set open option to 0)

pathName configure ?option? ?value option value ...?
  Query or modify the configuration options of the widget. If no option is specified, returns a list describing all of the available options for pathName. If option is specified with no value, then the command returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if no option is specified). If one or more option-value pairs are specified, then the command modifies the given widget option(s) to have the given value(s); in this case the command returns an empty string. Option may have any of the values accepted by the creation command. Read-only options are not be modified.

pathName delete ?arg...?
  Deletes all nodes (and children of them) in arg. arg can be a list of nodes or a list of list of nodes. To delete all the tree, do $pathName delete [$pathName nodes root].

pathName edit node text ?verifycmd? ?clickres? ?select?
  Provides a way for the user to edit in place the label of a node. This is possible only if node is visible (all its parents are open).
  The command takes the initial text as argument and does not modify the label of the edited node, but returns an empty string if edition is canceled, or the typed text if edition is accepted.
  When editing, the user can cancel by pressing Escape, or accept by pressing Return.
  clickres specifies what to do if the user click outside the editable area. If clickres is 0 (the default), the edition is canceled. If clickres is 1, the edition is accepted. In all other case, the edition continues.
  If edition is accepted and modifycmd is not empty, then it is called with the new text as argument and must return 1 to accept the new text, 0 to refuse it and continue edition.
  select specifies wether or not the initial text should be selected. Default is 1.

pathName exists node
  Returns whether or not node exists in the tree.

pathName index node
  Returns the position of node in its parent.

pathName insert index parent node ?option value...?
  Inserts a new node identified by node in the children list of parent at position index.

  -data
    User data associated to the node.
  -drawcross
    Specifies how the cross used to expand or collapse the children of a node should be drawn. Must be one of auto, allways or never.
    If auto, the cross is drawn only if the node has children. If allways, the cross is always drawn. If never, the cross is never drawn.
  -fill
    Specifies the foreground color of the label of the node.
  -font
    Specifies a font for the label of the node.
  -image
    Specifies an image to display at the left of the label of the node. window option override image.
  -open
    Specifies wether or not the children of the node should be drawn.
  -text
    Specifies the label of the node.
  -window
    Specifies a pathname to display at the left of the label of the node. window option override image.

pathName itemcget node option
  Returns the current value of a configuration option for the item. Option may have any of the values accepted by the item creation command.

pathName itemconfigure node ?option? ?value option value ...?
  This command is similar to the configure command, except that it applies to the options for an individual item, whereas configure applies to the options for the widget as a whole. Options may have any of the values accepted by the item creation widget command. If options are specified, options are modified as indicated in the command and the command returns an empty string. If no options are specified, returns a list describing the current options for the item. Read-only options are not be modified.

pathName move parent node index
  Moves node to the children list of parent at position index. parent can not be a descendant of node.

pathName nodes node
  Returns the children of node.

pathName opentree node
  This command open all the subtree given by node (recurse through the tree starting at node and set open option to 1)

pathName parent node
  Returns the parent of node.

pathName reorder node neworder
  Modifies the order of children of node given by neworder. Children of node that do not appear in neworder are no moved.

pathName see node
  Arrange the scrolling area to make node visible.

pathName selection cmd ?arg...?
  Modifies the list of selected nodes following cmd:
  clear
    remove all nodes of the selection.
  set
    set the selection to all nodes in arg
  add
    add all nodes of arg in the selection
  remove
    remove all nodes of arg of the selection
  get
    return the current selected nodes

pathName visible node
  Returns whether or not node is visible (all its parents are open).

pathName xview ?arg...?
  Standard command to enable horizontal scrolling of pathName.

pathName yview ?arg...?
  Standard command to enable vertical scrolling of pathName.