  NAME
    treeview - Create and manipulate hierarchical table widgets
  SYNOPSIS
  DESCRIPTION
  INTRODUCTION
  TREE DATA OBJECT
  SYNTAX
  IDS AND TAGS
  SPECIAL NODE IDS
    active
    anchor
    bottom
    current
    down
    end
    focus
    last
    mark
    next
    nextsibling
    parent
    prev
    prevsibling
    root
    tail
    top
    up
    view.top
    view.bottom
    @x,y
    @ID->LABEL->LABEL...
  DATA FIELDS
  ENTRY BINDINGS
  TREEVIEW OPERATIONS
    pathName bbox ?-screen? tagOrId...
      x
      y
      width
      height
    pathName bind tagName ?sequence command?
    pathName button operation ?args?
      pathName button activate tagOrId
      pathName button bind tagName ?sequence command?
      pathName button cget option
      pathName button configure ?option? ?value option value ...?
    pathName cget option
    pathName close ?-recurse? ?-trees? tagOrId...
    pathName column operation ?args?
      pathName column activate column
      pathName column bbox column entry
      pathName column bind column ?sequence command?
      pathName column cget name option
      pathName column configure name ?name ...? ?option? ?value option value ...?
      pathName column current
      pathName column delete field ?field...?
      pathName column index index
      pathName column insert position field ?field ...? ?options...?
      pathName column invoke field
      pathName column isset ?startOrTag? ?end?
      pathName column istree field
      pathName column move name dest
      pathName column names ?-visible? ?PATTERN?
      pathName column nearest x ?y?
      pathName column offsets
      pathName column resize op ...
      pathName column see ?-anchor anchor? field
      pathName column values ?-visible? ?-default value? field ?start? ?end?
    pathName configure ?option? ?value option value ...?
    pathName curselection
    pathName delete tagnode...
    pathName edit ?-test -root? X Y
    pathName entry operation ?args?
      pathName entry activate tagOrId
      pathName entry cget option
      pathName entry children tagOrId ?first? ?last?
      pathName entry configure tagnode ?option? ?value option value ...?
      pathName entry delete tagOrId ?first ?last?
      pathName entry depth tagOrId
      pathName entry down tagOrId
      pathName entry get tagOrId ?key? ?default?
      pathName entry isbefore tagOrId1 tagOrId2
      pathName entry ishidden tagOrId
      pathName entry isopen tagOrId
      pathName entry isset tagOrId col
      pathName entry isvisible tagOrId
      pathName entry next tagOrId
      pathName entry parent tagOrId
      pathName entry prev tagOrId
      pathName entry relabel tagOrId newLabel
      pathName entry select tagOrId
      pathName entry set tagOrId col ?value col value ...?
      pathName entry sibling ?-before? tagOrId
      pathName entry size -recurse tagOrId
      pathName entry unset tagOrId col
      pathName entry up tagOrId
      pathName entry value tagOrId ?col?
    pathName find ?flags? first last
      -addtag NAME
      -command command
      -column col
      -count
      -depth number
      -exact
      -exec string
        %#
        %W
        %p
        %P
        %V
        %F
        %C
        %%
      -glob
      -invert
      -isclosed
      -ishidden
      -isleaf
      -ismapped
      -isopen
      -istree
      -limit number
      -maxdepth
      -mindepth
      -name pattern
      -nocase
      -notop
      -regexp
      -reldepth
      -return col
      -top node
      -useformat
      -uselabel
      -usepath
      -userow
      -visible
      -withouttag NAME
      -withtag NAME
      -var variable
      -option name value
      --
    pathName focus ?tagOrId?
    pathName get ?-full? ?-labels? tagnode tagnode...
    pathName hide ?flags? tagOrId...
      -column col
      -depth number
      -exact
      -glob
      -invert
      -maxdepth
      -mindepth
      -name pattern
      -nocase
      -option name value
      -regexp
      -uselabel
      -usepath
      -withouttag NAME
      -withtag NAME
      --
    pathName index ?-at tagOrId? ?-path? ?-quiet? string
    pathName insert ?-node num? ?-at tagOrId? ?-styles styleslist? ?-tags tagslist? position ?path? ?options...? ?path? ?options...?
    pathName move tagnode how destId
      before
      after
      into
    pathName nearest ?-root? ?-strict? x y ?varName?
    pathName open ?-recurse? ?-trees? tagnode...
    pathName range ?-open? first last
    pathName scan option args
      pathName scan mark x y
      pathName scan dragto x y.
    pathName see ?-anchor anchor? tagOrId
    pathName selection option arg
      pathName selection anchor ?tagOrId? ?column?
      pathName selection cells
      pathName selection clear first ?last? ?column?
      pathName selection clearall
      pathName selection mark tagOrId ?column?
      pathName selection includes tagOrId ?column?
      pathName selection present
      pathName selection set first ?last? ?column?
      pathName selection toggle first ?last? ?column?
    pathName show ?flags? tagOrId...
    pathName sort ?operation? args...
      pathName sort auto ?boolean
      pathName sort cget option
      pathName sort configure ?option? ?value option value ...?
        -column string
        -command string
        -decreasing boolean
        -mode string
        -setflat bool
          ascii
          dictionary
          integer
          real
          command
      pathName sort once ?flags? tagOrId...
        -recurse
    pathName style operation ?args?
      pathName style activate entry column
      pathName style cget stylename option
      pathName style configure ?stylename option? ?value option value ...?
      pathName style create ...?
        pathName style create barbox stylename ?option value option value ...?
        pathName style create checkbox stylename ?option value option value ...?
        pathName style create combobox stylename ?option value option value ...?
        pathName style create textbox stylename ?option value option value ...?
        pathName style create windowbox ?stylename? ?option value option value ...?
      pathName style find stylename ?column? ?node? ...
      pathName style forget stylename ...
      pathName style get column tagorid
      pathName style highlight stylename ?on|off?
      pathName style names
      pathName style set stylename column node ...
      pathName style slaves ?-col col? ?-id node? ?-style styleName? ?-visible bool? ?-info path?
    pathName tag operation args
      pathName tag add string ?id...?
      pathName tag delete string tagnode...
      treeName tag exists string ?id?
      pathName tag forget string
      pathName tag names ?id?
      pathName tag nodes name ?name ...?
    pathName toggle tagnode
    pathName xview args
      pathName xview
      pathName xview tagOrId
      pathName xview moveto fraction
      pathName xview scroll number what
    pathName yview ?args?
      pathName yview
      pathName yview tagOrId
      pathName yview moveto fraction
      pathName yview scroll number what
  TREEVIEW EDITING
  TREEVIEW OPTIONS
    -activeicons images
    -activeleaficons images
    -allowduplicates boolean
    -altstyle stylename
    -autocreate boolean
    -background color
    -borderwidth pixels
    -button string
    -closecommand string
      %W
      %p
      %P
      %#
      %%
    -columnshowhighlight bool
    -cursor cursor
    -dashes number
    -emptystyle stylename
    -entryshowhighlight bool
    -exportselection boolean
    -fillnull boolean
    -flat boolean
    -focusdashes dashList
    -focusforeground color
    -focusheight value
    -font fontName
    -foreground color
    -height pixels
    -hidedataicons boolean
    -hidedatatext boolean
    -hideicons boolean
    -hideleaves boolean
    -hideroot boolean
    -highlightbackground color
    -highlightcolor color
    -highlightthickness pixels
    -icons images
    -imagecmd scriptcmd
    -inlinedata bool
    -insertfirstnum
    -leaficons images
    -levelpad pixels
    -levelstyles stylenames
    -linecolor color
    -linespacing pixels
    -linewidth pixels
    -minheight pixels
    -nextautonum
    -nextsubautonum
    -newtags boolean
    -noautocloseleaf boolean
    -nofocusselectbackground color
    -nofocusselectforeground color
    -openanchor string
    -opencommand string
      %W
      %p
      %P
      %#
      %%
    -relief relief
    -resizecursor string
    -rootnode num
    -scrollmode mode
      listbox
      hierbox
      canvas
    -scrolltile bool
    -selectbackground color
    -selectborderwidth pixels
    -selectcommand string
    -selectforeground color\fB
    -selectmode mode
    -selectrelief relief
    -selecttile image
    -separator string
    -showfull boolean
    -showtitles boolean
    -sortselection boolean
    -stylecommand string
    -substyle stylename
    -takefocus focus
    -tile image
    -titlefont font
    -titlepad N
    -tree tree
    -trim string
    -underline height
    -width pixels
    -xscrollcommand string
    -xscrollincrement pixels
    -yscrollcommand string
    -yscrollincrement pixels
  ENTRY OPTIONS
    -activeicons images
    -bindtags tagList
    -button string
    -closecommand string
      %W
      %p
      %P
      %#
      %%
    -data list
    -font fontName
    -forcetree bool
    -foreground color
    -height num
    -hide bool
    -icons images
    -label string
    -opencommand string
      %W
      %p
      %P
      %#
      %%
    -shadow color
    -state value
    -style stylename
    -sublabel string
    -underline num
    -userdata list
  BUTTON OPTIONS
    -activebackground color
    -activeforeground color
    -background color
    -borderwidth pixels
    -closerelief relief
    -cursor cursor
    -foreground color
    -images images
    -openrelief relief
    -size pixels
  STYLE OPTIONS
    -activebackground color
    -activeforeground color
    -background color
    -cursor cursorname
    -font fontName
    -foreground color
    -gap N
    -hide bool
    -highlightbackground color
    -highlightforeground color
    -icon name
    -priority N
    -shadow shadow
    -tile img
    The following additional configuration options are available for textbox:
    -formatcmd scriptcmd
    -iconside N
    -side N
    The following additional configuration options are available for combobox:
    -borderwidth pixel
    -buttonborderwidth pixel
    -buttonrelief relief
    -choicecmd cmd
    -choices lst
    The following additional configuration options are available for checkbox:
    -boxcolor color
    -boxsize num
    -checkcolor color
    -fillcolor color
    -linewidth num
    -offvalue val
    -onvalue val
    -showvalue bool
    The following additional configuration options are available for barbox:
    -barbg color
    -boxcolor color
    -barfg color
    -barheight num
    -barwidth num
    -filltile tile
    -formatcmd scriptcmd
    -linewidth num
    -maxvalue val
    -minvalue val
    -showvalue bool
    Only the following configuration options are available with windowbox:
    -minheight num
    -minwidth num
    -windowcmd string
      %W
      %p
      %P
      %#
      %C
      %%
  COLUMN OPTIONS
    -activetitlebackground color
    -activetitleforeground color
    -autowidth value
    -background color
    -bindtags string
    -borderwidth pixels
    -colorpattern patcolors
    -colorregexp patcolors
    -command string
      %W
      %C
      %%
    -edit num
    -editopts values
      -auto bool
      -editcmd cmd
      -embed bool
      -endcmd cmd
      -leafs bool
      -nottnull bool
      -opts values
      -readonly bool
      -sel bool
      -startcmd cmd
      -titles bool
      -widget wid
      -withtag tag
      -withouttag tag
      -wrap value
    -fillcmd scriptcmd
    -hide boolean
    -justify justify
    -max size
    -min size
    -pad pad
    -relief relief
    -ruledashes value
    -scrolltile bool
    -sortcommand script
    -sortmode mode
    -state state
    -style stylename
    -tile image
    -title string
    -titlearrow value
    -titlebackground color
    -titleborderwidth size
    -titlefont font
    -titlejustify just
    -titleforeground color
    -titlerelief relief
    -titleshadow color
    -titlestyle style
    -width num
    -underline num
    -validatecmd command
    -weight float
    -width pixels
  EMBEDDED WINDOWS
  OLD TEXT EDITING OPTIONS
    -background color
    -borderwidth pixels
    -exportselection boolean
    -relief relief
    -selectbackground color
    -selectborderwidth pixels
    -selectforeground color
    -selectrelief relief
  DEFAULT BINDINGS
  WIDGET BINDINGS
    <ButtonPress-2>
    <B2-Motion>
    <ButtonRelease-2>
    <B1-Leave>
    <B1-Enter>
    <KeyPress-Up>
    <KeyPress-Down>
    <Shift-KeyPress-Up>
    <Shift-KeyPress-Down>
    <KeyPress-Prior>
    <KeyPress-Next>
    <KeyPress-Left>
    <KeyPress-Right>
    <KeyPress-space>
    <KeyRelease-space>
    <KeyPress-Return>
    <KeyRelease-Return>
    <KeyPress>
    <KeyPress-Home>
    <KeyPress-End>
    <Control-a>
    <Control-o>
    <Control-Shift-O>
    <Double-ButtonRelease-1>
    <Alt-Double-ButtonRelease-1>
    <Control-KeyPress-minus>
    <KeyPress-F1>
    <KeyPress-F2>
    <KeyPress-F3>
    <KeyPress-F4>
    <Control-Shift-O>
    <Control-Shift-C>
  BUTTON BINDINGS
    <Enter>
    <Leave>
    <ButtonRelease-1>
  ENTRY BINDINGS
    <Enter>
    <Leave>
    <ButtonPress-1>
    <Double-ButtonPress-1>
    <B1-Motion>
    <ButtonRelease-1>
    <Shift-ButtonPress-1>
    <Shift-Double-ButtonPress-1>
    <Shift-B1-Motion>
    <Shift-ButtonRelease-1>
    <Control-ButtonPress-1>
    <Control-Double-ButtonPress-1>
    <Control-B1-Motion>
    <Control-ButtonRelease-1>
    <Control-Shift-ButtonPress-1>
    <Control-Shift-Double-ButtonPress-1>
    <Control-Shift-B1-Motion>
  COLUMN BINDINGS
    <Enter>
    <Leave>
    <ButtonRelease-1>
  COLUMN RULE BINDINGS
    <Enter>
    <Leave>
    <ButtonPress-1>
    <B1-Motion>
    <ButtonRelease-1>
  QUICKSTART
  EXAMPLE
  OLD TREEVIEW EDITS
    When editing the subwidget .edit is available.
    pathName.edit operation ?args?
      pathName.edit apply
      pathName.edit cancel
      pathName.edit cget value
      pathName.edit configure ?option value?
    pathName.edit delete first last
    pathName.edit get ?-root? x y
    pathName.edit icursor index
    pathName.edit index index
    pathName.edit insert index string
    pathName.edit selection args
      pathName.edit selection adjust index
      pathName.edit selection clear
      pathName.edit selection from index
      pathName.edit selection present
      pathName.edit selection range start end
      pathName.edit selection to index
  NOTES
  KEYWORDS

### NAME

treeview - Create and manipulate hierarchical table widgets

### SYNOPSIS

treeview pathName ?options?

### DESCRIPTION

The treeview widget displays a tree of data and provides data sharing (via tree data objects) and the ability to tag nodes.

### INTRODUCTION

The treeview widget is used to display hierarchical data. Data is represented as nodes in a general-ordered tree. Each node may have sub-nodes and these nodes can in turn has their own children.

A node is displayed as a row entry in the widget. Each entry has a text label and icon. When a node has children, its entry is drawn with a small button to the left of the label. Clicking the mouse over this button opens or closes the node. When a node is open, its children are exposed. When it is closed, the children and their descedants are hidden. The button is normally a + or - symbol (ala Windows Explorer), but can be replaced with a pair of Tk images (open and closed images).

If the node has data associated with it, they can be displayed in columns running vertically on either side the tree. Data may be set using an entries -data option,the entry set subcommand, or via the tree data object. You can control the color, font, etc of each entry. Any entry label or data field can be edited in-place.

### TREE DATA OBJECT

The tree is not stored inside the widget but in a tree data object (see the tree command for a further explanation). Tree data objects can be shared among different clients, such as a treeview widget or the tree command. You can walk the tree and manage its data with the tree command tree, while displaying it with the treeview widget. Whenever the tree is updated, the treeview widget is automatically redrawn.

By default, the treeview widget creates its own internal tree object and this initially contains just a root node. But if you wish to share a tree, you can created one with the tree command and set it via the -tree configuration option. Treeview widgets can share this tree object, and even display a sub-node as the root of the tree.

A tree object has both a Tcl and C API. You can insert or delete nodes using treeview widget or tree command operations, but also from C code. For example, you can load the tree from your C code while still managing and displaying the tree from Tcl. The widget is automatically notified whenever the tree is modified via C or Tcl.

### SYNTAX

  treeview pathName ?option value?...

The treeview command creates a new window pathName and makes it into a treeview widget. At the time this command is invoked, there must not exist a window named pathName, but pathName's parent must exist. Additional options may be specified on the command line or in the option database to configure aspects of the widget such as its colors and font. See the configure operation below for the exact details about what option and value pairs are valid.

If successful, treeview returns the path name of the widget. It also creates a new Tcl command by the same name. You can use this command to invoke various operations that query or modify the widget. The general form is:

  pathName operation ?arg?...

Both operation and its arguments determine the exact behavior of the command. The operations available are described in the section.

### IDS AND TAGS

Nodes can be inserted into a tree using the treeview widget

    blt::treeview .t
    set node [.t insert end root "one"]

or tree command.

    set tree [blt::tree create]
    set node [$tree insert root "one"]

In both cases, a number identifying the node is returned (the value of $node). This serial number or id uniquely identifies the node. Please note that you can't infer a location or position of a node from its id. The only exception is that the root node is always id 0. Since nodes may have the same labels or be moved within the tree, ids provide an convenient way to identify nodes. If a tree is shared, the ids will be the same regardless if you are using by the treeview widget or the tree command. Ids are recycled when the node deleted.

A node may also have any number of tags associated with it. A tag is just a string of characters, and it may take any form except that of an integer. For example, "x123" is valid, but "123" isn't. The same tag may be associated with many different nodes. This is typically done to associate a group of nodes. Many operations in the treeview widget take either node ids or tag names as arguments. Using a tag says to apply the operation to all nodes with that tag.

The tag all is implicitly associated with every node in the tree. It may be used to invoke operations on all the nodes in the tree.

Commands that take a tagnode will also accept a list of zero or more integer node numbers. A node-list must contain only integers, and the list can not have any leading spaces. Node lists can simplify the use of iterating commands. Tags and taglist are more widely used in tree than in treeview.

Tags may be shared, just like trees, between clients. For example, you can use the tags created by the tree command with treeview widgets.

### SPECIAL NODE IDS

There are also several special non-numeric ids. Special ids differ from tags in that they are always translated to their numeric equivalent. They also take precedence over tags. For example, you can't use a tag name that is a special id. These ids are specific to the treeview widget.

active
  The node where the mouse pointer is currently located. When a node is active, it is drawn using its active icon (see the -activeicon option). The active id is changed automatically by moving the mouse pointer over another node or by using the entry activate operation. Note that there can be only one active node at a time.

anchor
  The node representing the fixed end of the current selection. The anchor is set by the selection anchor operation.

bottom
  The last viewable node.

current
  The node where the mouse pointer is currently located. But unlike active, this id changes while the selection is dragged. It is used to determine the current node during button drags.

down
  The next open node from the current focus. The down of the last open node is the same.

end
  The last node at depth 1 in tree.

focus
  The node that currently has focus. When a node has focus, it receives key events. To indicate focus, the node is drawn with a dotted line around its label. You can change the focus using the focus operation.

last
  Same as tail.

mark
  The node representing the non-fixed end of the current selection. The mark is set by the selection mark operation.

next
  The next open node from the current focus. But unlike down, when the focus is on last open node, next wraps around to the root node.

nextsibling
  The next sibling from the node with the current focus. If the node is already the last sibling then it is the nextsibling.

parent
  The parent of the node with the current focus. The parent of the root is also the root.

prev
  The last open node from the current focus. But unlike up, when the focus is at root, last wraps around to the last open node in the tree.

prevsibling
  The previous sibling from the node with the current focus. If the node is already the first sibling then it is the prevsibling.

root
  The root node. You can also use id 0 to indicate the root.

tail
  The last node in the tree, viewable or not.

top
  The first node.

up
  The last open node (in depth-first order) from the current focus. The up of the root node (i.e. the root has focus) is also the root.

view.top
  First node that's current visible in the widget.

view.bottom
  Last node that's current visible in the widget.

@x,y
  Indicates the node that covers the point in the treeview window specified by x and y (in pixel coordinates). If no part of the entryd covers that point, then the closest node to that point is used.

@ID->LABEL->LABEL...
  Lookup via node labels, eg. 0->Main->Users. Quotes can be used around labels that use reserved words or contain spaces, eg. 0->"Main"->'User Groups'. See the tree man page for more details.

A node may be specified as an id or tag. If the specifier is an integer then it is assumed to refer to the single node with that id. If the specifier is not an integer, it's checked to see if it's a special id (such as focus). Otherwise, it's assumed to be tag. Some operations only operate on a single node at a time; if a tag refers to more than one node, then an error is generated.

### DATA FIELDS

A node in the tree can have data field. A data field is a name-value pair, used to represent arbitrary data in the node. Nodes can contain different fields (they aren't required to contain the same fields). You can optionally display these fields in the treeview widget in columns running on either side of the displayed tree. A node's value for the field is drawn in the column along side its node in the hierarchy. Any node that doesn't have a specific field is left blank. Columns can be interactively resized, hidden, or, moved.

### ENTRY BINDINGS

You can bind Tcl commands to be invoked when events occur on nodes (much like Tk canvas items). You can bind a node using its id or its bindtags. Bindtags are simply names that associate a binding with one or more nodes. There is a built-in tag all that all node entries automatically have.

### TREEVIEW OPERATIONS

The treeview operations are the invoked by specifying the widget's pathname, the operation, and any arguments that pertain to that operation. The general form is:

    pathName operation ?arg arg ...?

Operation and the args determine the exact behavior of the command. The following operation are available for treeview widgets:

pathName bbox ?-screen? tagOrId...
  Returns a list of 4 numbers, representing a bounding box of around the specified entries. The entries is given by one or more tagOrId arguments. If the -screen flag is given, then the x-y coordinates of the bounding box are returned as screen coordinates, not virtual coordinates. Virtual coordinates start from 0 from the root node and include the title. If the -world flag is given, then the y coordinate the title height is added in. The returned list contains the following values.

  x
    X-coordinate of the upper-left corner of the bounding box.

  y
    Y-coordinate of the upper-left corner of the bounding box.

  width
    Width of the bounding box.

  height
    Height of the bounding box.

pathName bind tagName ?sequence command?
  Associates command with tagName such that whenever the event sequence given by sequence occurs for a node with this tag, command will be invoked. The syntax is similar to the bind command except that it operates on treeview entries, rather than widgets. The tagName can be an entry or tag, or predefined tags such as all, Entry or Button. See the bind manual entry for complete details on sequence and the substitutions performed on command before invoking it.

  If all arguments are specified then a new binding is created, replacing any existing binding for the same sequence and tagName. If the first character of command is + then command augments an existing binding rather than replacing it. If no command argument is provided then the command currently associated with tagName and sequence (it's an error occurs if there's no such binding) is returned. If both command and sequence are missing then a list of all the event sequences for which bindings have been defined for tagName.

pathName button operation ?args?
  This command is used to control the button selectors within a treeview widget. It has several forms, depending on operation:

  pathName button activate tagOrId
    Designates the node given by tagOrId as active. When a node is active it's entry is drawn using its active icon (see the -activeicon option). Note that there can be only one active entry at a time. The special id active indicates the currently active node.

  pathName button bind tagName ?sequence command?
    Associates command with tagName such that whenever the event sequence given by sequence occurs for an button of a node entry with this tag, command will be invoked. The syntax is similar to the bind command except that it operates on treeview buttons, rather than widgets. See the bind manual entry for complete details on sequence and the substitutions performed on command before invoking it.

    If all arguments are specified then a new binding is created, replacing any existing binding for the same sequence and tagName. If the first character of command is + then command augments an existing binding rather than replacing it. If no command argument is provided then the command currently associated with tagName and sequence (it's an error occurs if there's no such binding) is returned. If both command and sequence are missing then a list of all the event sequences for which bindings have been defined for tagName.

  pathName button cget option
    Returns the current value of the configuration option given by option. Option may have any of the values accepted by the configure operation described below.

  pathName button 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 (see Tk_ConfigureInfo for information on the format of this list). 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 and value are described in the section below.

pathName cget option
  Returns the current value of the configuration option given by option. Option may have any of the values accepted by the configure operation described below.

pathName close ?-recurse? ?-trees? tagOrId...
  Closes the node specified by tagOrId. In addition, if a Tcl script was specified by the -closecommand option, it is invoked. If the node is already closed, this command has no effect. If the -recurse flag is present, each child node is recursively closed. The -trees flag is like -recurse but operates only on nodes with children, excluding the root.

pathName column operation ?args?
  The following operations are available for treeview columns.

  pathName column activate column
    Sets the active column to column. Column is the name of a column in the widget. When a column is active, it's drawn using its -activetitlebackground and -activetitleforeground options. If column is the "", then no column will be active. If no column argument is provided, then the name of the currently active column is returned.

  pathName column bbox column entry
    Returns a list of 4 numbers, representing a bounding box of around the specified entries cell. Giving an entry of -1 matches the title row.

  pathName column bind column ?sequence command?
    Associates command with column such that whenever the event sequence given by sequence occurs for a column node entry with this tag, command will be invoked. The syntax is similar to the bind command except that it operates on treeview colunns, rather than widgets. See the bind manual entry for complete details on sequence and the substitutions performed on command before invoking it.

  pathName column cget name option
    Returns the current value of the column configuration option given by option for name. Name is the name of column that corresponds to a data field. Option may have any of the values accepted by the configure operation described below.

  pathName column configure name ?name ...? ?option? ?value option value ...?
    Query or modify the configuration options of one or more columns name. Name is the name of the column corresponding to a data field. If no option is specified, returns a list describing all of the available options for pathName (see Tk_ConfigureInfo for information on the format of this list). 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 and value are described in the section below.

  pathName column current
    Get column currently under the mouse.

  pathName column delete field ?field...?
    Deletes one of more columns designated by field. Requests to delete the tree column are silently ignored. Note that this does not delete the data fields themselves.

  pathName column index index
    Return the integer for index. May use "end" or "end-N".

  pathName column insert position field ?field ...? ?options...?
    Inserts one (or more) columns designated by field. A column displays each entry node's data field using this name. If the node doesn't define the given field, the cell is left blank. Position indicates where in the list of columns to add the new column. It may be either a name, a number or end. If multiple fields are given, they may not start with a dash. If field is the empty string or #auto, a name is generated prefixed by the string Col plus a unique integer. If field ends with #auto, the generated name uses it's prefix instead. The returned values is the created column names. Note that the predefined tree column (ie. BLT-TreeView) is aliased by Col0.

  pathName column invoke field
    Invokes the Tcl command associated with the column field, if there is one (using the column's -command option). The command is ignored if the column's -state option set to disabled.

  pathName column isset ?startOrTag? ?end?
    Returns list of data columns for elements in range actually having data values set in them. One possible use for this might be hiding columns which are empty. With no arguments, checks only entries on the visible screen. With one argument, checks all entries matching a tag or id. With two arguments, checks all entries between start and end range.

  pathName column istree field
    Return 1 if column is the tree column.

  pathName column move name dest
    Moves the column name to the destination position. Dest is the offset, name of another column or a screen position in the form @x,y.

  pathName column names ?-visible? ?PATTERN?
    Returns a list of the names of all columns in the widget. The list is ordered as the columns are drawn from left-to-right. If -visible, then display only columns where -hide is 0. A pattern may be specified to limit results.

  pathName column nearest x ?y?
    Returns the name of the column closest to the given X-Y screen coordinate. If you provide a y argument (it's optional), a name is returned only when if the point is over a column's title.

  pathName column offsets
    Returns the starting offsets for each column.

  pathName column resize op ...
    Operations for resize where op is one of activate, anchor, mark or set.

  pathName column see ?-anchor anchor? field
    Adjusts the view so that the column given by field is visible in the widget window. The node's position on the screen can be set using the -anchor flag. Its value is a Tk anchor position: w, c, e.

  pathName column values ?-visible? ?-default value? field ?start? ?end?
    Returns a list of data values for a column. The -visible flag excludes the values that are hidden or inside closed subtrees. The root nodes does not get included when -hideroot is true. The -default option specifies a value to substitute for unset data column cells.

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 (see Tk_ConfigureInfo for information on the format of this list). 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 and value are described in the section below.

pathName curselection
  Returns a list containing the ids of all of the entries that are currently selected. If there are no entries selected, then the empty string is returned.

pathName delete tagnode...
  Deletes one or more entries given by tagnode and its children.

pathName edit ?-test -root? X Y
  Test if edit is complete.

pathName entry operation ?args?
  The following operations are available for treeview entries.

  pathName entry activate tagOrId
    Sets the active entry to the one specified by tagOrId. When an entry is active it is drawn using its active icon (see the -activeicon and -activeleaficon options). The special id of the currently active node is active. Note that there can be only one active node at a time and currently icons must be the same size/shape as the backgrounds are not cleared. But bind can be used to overcome these limitations.

  pathName entry cget option
    Returns the current value of the configuration option given by option. Option may have any of the values accepted by the configure operation described below.

  pathName entry children tagOrId ?first? ?last?
    Returns a list of ids for the given range of children of tagOrId. TagOrId is the id or tag of the node to be examined. If only a first argument is present, then the id of the that child at that numeric position is returned. If both first and last arguments are given, then the ids of all the children in that range are returned. Otherwise the ids of all children are returned.

  pathName entry configure tagnode ?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 tagnode (see Tk_ConfigureInfo for information on the format of this list). 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 and value are described below:

  pathName entry delete tagOrId ?first ?last?
    Deletes the one or more children nodes of the parent tagOrId. If first and last arguments are present, they are positions designating a range of children nodes to be deleted.

  pathName entry depth tagOrId
    Return tree depth of node where root is 0.

  pathName entry down tagOrId
    The next open node from the given node. The down of the last open node is the same.

  pathName entry get tagOrId ?key? ?default?
    Return a key-field value for an entry. When no key is given, returns the values of all visible columns. If the given key is undefined, return default if given, else throw an error. Unlike entry set, the tree is accessed directly so keys not having associated columns are supported.

  pathName entry isbefore tagOrId1 tagOrId2
    Returns 1 if tagOrId1 is before tagOrId2 and 0 otherwise.

  pathName entry ishidden tagOrId
    Returns 1 if the node is currently hidden and 0 otherwise. A node is also hidden if any of its ancestor nodes are closed or hidden.

  pathName entry isopen tagOrId
    Returns 1 if the node is currently open and 0 otherwise.

  pathName entry isset tagOrId col
    Return true if the entry sets a column-field (has a value). The entry and column both must exist.

  pathName entry isvisible tagOrId
    Returns 1 if node is not hidden, inside a closed subtree.

  pathName entry next tagOrId
    The next open node from the given node. But unlike down, when the focus is on last open node, next wraps around to the root node.

  pathName entry parent tagOrId
    Returns parent of the given node.

  pathName entry prev tagOrId
    The last open node from the given node. But unlike up, when the focus is at root, last wraps around to the last open node in the tree.

  pathName entry relabel tagOrId newLabel
    Change the tree node label associated with an entry. This sets the tree node label; ie. the value returned by the get command. Note this is not the same thing as the treeview entries -label option. Also, the -allowduplicates option must be enabled to use this command as no duplicate checking will be performed.

  pathName entry select tagOrId
    Make the given node visible and give it the focus. When in single selectmode, select it (calls ::blt::tv::MoveFocus)

  pathName entry set tagOrId col ?value col value ...?
    Get or set column-fields for an entry. Provides a simple way to read or update fields from the -data option of an entry.

  pathName entry sibling ?-before? tagOrId
    The next/previous sibling from the given node. If the node is already the last/first sibling then nothing is returned.

  pathName entry size -recurse tagOrId
    Returns the number of children for parent node tagOrId. If the -recurse flag is set, the number of all its descendants is returned. The node itself is not counted.

  pathName entry unset tagOrId col
    Unset a column-field for an entry.

  pathName entry up tagOrId
    The last open node (in depth-first order) from the given node. The up of the last node is itself.

  pathName entry value tagOrId ?col?
    Return the value for an entry column, or all visible columns if col not given. Unlike entry set, this gives access to the formatted value from -formatcmd (if there was one).

pathName find ?flags? first last
  Finds for all entries matching the criteria given by flags. A list of ids for all matching nodes is returned. First and last are ids designating the range of the search in depth-first order. If last is before first, then nodes are searched in reverse order. The valid flags are:

  -addtag NAME
    Add tag to each matching entry.

  -command command
    Invoke command for each matching node. Before command is invoked, the id of the node is appended. If command generates an error, processing stops and the find operation returns an error.

  -column col
    Match name against value of given column. Must be used with -name and can not use with -usepath.

  -count
    Just return the number of matches.

  -depth number
    Entry must be at depth number.

  -exact
    Patterns must match exactly. The is the default.

  -exec string
    Specifies a Tcl script to be evaluated for each matching node. If -var was also specified, that variable is set with the value of the node id before each evaluation. Otherwise, percent sustitutions are performed: note this is much less efficient than using either -var or -command

    The result of each eval gets appended to the return list, unless the script issues a CONTINUE, in which case that node is skipped.

    The available percent substitutions on string are:

    %#
      The id of the node.

    %W
      The pathname of the widget.

    %p
      The name of the node.

    %P
      The full pathname of the node.

    %V
      The current value (the node name, node label or column value).

    %F
      Like %V, but returns the on-screen value (from -formatcmd).

    %C
      The current column.

    %%
      Translates to a single percent.

  -glob
    Use global pattern matching. Matching is done in a fashion similar to that used by string match.

  -invert
    Invert the meaning of the pattern match for -name.

  -isclosed
    Include only entries that are closed.

  -ishidden
    Include only entries that are hidden, either because the entry has set -hide, or is has style that is hidden. The root node is not included.

  -isleaf
    Entry must not have child nodes.

  -ismapped
    Include only entries that are currently all or partly drawn on screen. The root node is not included.

  -isopen
    Include only entries that are opened.

  -istree
    Entry must have child nodes.

  -limit number
    Stop searching after number matches.

  -maxdepth
    Entry must be at depth or lower.

  -mindepth
    Entry must be at depth or higher.

  -name pattern
    Specifies pattern to match against node names.

  -nocase
    Comparisison is ignores case. For -regexp, the target string gets lower cased (but not the pattern).

  -notop
    Exclude the -top or starting node.

  -regexp
    Use regular expression pattern matching (i.e. the same as implemented by the regexp command).

  -reldepth
    Change the meaning of -depth, -mindepth and -maxdepth to be relative to the -top node.

  -return col
    Instead of the node id, return data value of named column. If col starts with a %, performs percent substitution as per -command. Note that a percent substitution longer than 2 chars will append values as list elements.

  -top node
    Search is only at node and it's descendants. The default is the root node.

  -useformat
    Compare pattern using -formatcmd value (if there is one) instead key data value.

  -uselabel
    Compare pattern using label (if there is one) instead last component of path.

  -usepath
    Compare pattern using the full path name.

  -userow
    Compare pattern using the node value plus the values of all keys in the row. If used with -visible, only the visible column keys are used.

  -visible
    Exclude values that are hidden or inside closed subtrees. eg. The root node is excluded if -hideroot is true.

  -withouttag NAME
    Match entries without tag.

  -withtag NAME
    Match entries with tag.

  -var variable
    A variable to set with the node id before each iteration of the -exec script.

  -option name value
    Specifies an option name and value to match against the node entry's configuration option.

  --
    Indicates the end of flags.

pathName focus ?tagOrId?
  Get or set the focus to the node given by tagOrId. When a node has focus, it can receive keyboard events. The special id focus designates the node that currently has focus.

pathName get ?-full? ?-labels? tagnode tagnode...
  Translates one or more ids to their node entry names. It returns a list of names for all the ids specified. If the -full flag is set, then the full pathnames are returned. If the -labels flag is set, then the full pathnames using labels are returned.

  Note: Except when a called with a single node id (ie. an integer), the result will be a list (or list of lists when -separator isn't set).

pathName hide ?flags? tagOrId...
  Hides all nodes matching the criteria given by flags. If no tagOrId are given, traverses entire tree. The valid flags are described below:

  -column col
    Match name against value of given column. Must be used with -name and can not use -usepath.

  -depth number
    Entry must be at depth number.

  -exact
    Match patterns exactly. The is the default.

  -glob
    Use global pattern matching. Matching is done in a fashion similar to that used by string match.

  -invert
    Invert the meaning of the pattern match for -name or -option.

  -maxdepth
    Entry must be at depth or lower.

  -mindepth
    Entry must be at depth or higher.

  -name pattern
    Specifies pattern to match against node names.

  -nocase
    Ignore case in match.

  -option name value
    Specifies an option name and value to match against the node entry's configuration option.

  -regexp
    Use regular expression pattern matching (i.e. the same as implemented by the regexp command).

  -uselabel
    Specifies that the -name pattern is to match the label.

  -usepath
    Specifies that the -name pattern is to match the full path.

  -withouttag NAME
    Match entries with tag.

  -withtag NAME
    Match entries with tag.

  --
    Indicates the end of flags.

pathName index ?-at tagOrId? ?-path? ?-quiet? string
  Returns the id of the node specified by string. String may be a tag or node id. Some special ids are normally relative to the node that has focus but the -at option can be used to change this. The -path flag does a lookup using String as a path relative the tree root (unless the -at option is given). The the -quiet flag is given, lookup failures quietly return the empty string.

pathName insert ?-node num? ?-at tagOrId? ?-styles styleslist? ?-tags tagslist? position ?path? ?options...? ?path? ?options...?
  Inserts one or more nodes at position. Position is the location (number or end) where the new nodes are added to the parent node. Path is the pathname of the new node. Pathnames can be formatted either as a Tcl list (each element is a path component) or as a string separated by a special character sequence (using the -separator option). Pathnames are normally absolute, but the -at switch lets you select a relative starting point. Its value is the id of the starting node.

  If path name and options are ommitted, path will default to #auto.

  A path name of #auto attempts to use the tree node name as the path name. For large flat trees setting -allowduplicates to true can greatly speedup loading #auto as it avoids checking overhead. This is the fastest way to bulk load large numbers of nodes (next to using -tree).

  If the last component of a path name ends in #auto, the path is generated using the string prefix (before #auto) followed by a sequential number unique within the parent, eg. .t insert end {users u#auto}.

  The -node switch lets you specify a tree node number directly instead of having one generating automatically. For multi-node inserts, the node number is incremented.

  The -styles switch specifies a list of column/stylename pairs to set for elements of the -data option.

  The -tags switch specifies a list of tags to add to the new entries.

  Note that all ancestors of the new node must already exist, unless the -autocreate option is set. It is also an error if a node already exists, unless the -allowduplicates option is set.

  The option and value arguments may have any of the values accepted by the entry configure operation described in the section below. The returned value is list of ids for the new entries.

pathName move tagnode how destId
  Moves the node(s) given by tagnode to the destination node. The node can not be an ancestor of the destination. DestId is the id of the destination node and can not be the root of the tree. In conjunction with how, it describes how the move is performed.

  before
    Moves the node before the destination node.

  after
    Moves the node after the destination node.

  into
    Moves the node to the end of the destination's list of children.

pathName nearest ?-root? ?-strict? x y ?varName?
  Returns the id of the node entry closest to the given X-Y screen coordinate. If the coordinate is not directly over any node, then the nearest node is returned. If the argument varName is present, this is a Tcl variable that is set to either button, icon, label, title, titlelabel, titleicon, datalabel, dataicon, or "" depending what part of the entry the coordinate lies. The -root option subtracts the windows root from the coordinates. The -strict option fails the match if not directly over a node, eg. in the title or past end of last row.

pathName open ?-recurse? ?-trees? tagnode...
  Opens the one or more nodes specified by tagnode. If a node is not already open, the Tcl script specified by the -opencommand option is invoked. If the -recurse flag is present, then each descendant is recursively opened. The -trees flag is like -recurse but operates only on nodes with children.

pathName range ?-open? first last
  Returns the ids in depth-first order of the nodes between the first and last ids. If the -open flag is present, it indicates to consider only open nodes. If last is before first, then the ids are returned in reverse order.

pathName scan option args
  This command implements scanning. It has two forms, depending on option:

  pathName scan mark x y
    Records x and y and the current view in the treeview window; used in conjunction with later scan dragto commands. Typically this command is associated with a mouse button press in the widget. It returns an empty string.

  pathName scan dragto x y.
    Computes the difference between its x and y arguments and the x and y arguments to the last scan mark command for the widget. It then adjusts the view by 10 times the difference in coordinates. This command is typically associated with mouse motion events in the widget, to produce the effect of dragging the list at high speed through the window. The return value is an empty string.

pathName see ?-anchor anchor? tagOrId
  Adjusts the view of entries so that the node given by tagOrId is visible in the widget window. It is an error if tagOrId is a tag that refers to more than one node. The node's position on the screen can be set using the -anchor flag. Its value is a Tk anchor position: n, c, s.

pathName selection option arg
  This command is used to adjust the selection within a treeview widget. It has several forms, depending on option:

  pathName selection anchor ?tagOrId? ?column?
    Sets the selection anchor to the node given by tagOrId. If tagOrId refers to a non-existent node, then the closest node is used. The selection anchor is the end of the selection that is fixed while dragging out a selection with the mouse. The special id anchor may be used to refer to the anchor node. With no arguments, returns anchor entry and column if any.

  pathName selection cells
    Returns pairs of nodes and columns for all selected cells. The -selectmode must be cell or multicell.

  pathName selection clear first ?last? ?column?
    Removes the entries between first and last (inclusive) from the selection. Both first and last are ids representing a range of entries. If last isn't given, then only first is deselected. Entries outside the selection are not affected.

  pathName selection clearall
    Clears the entire selection.

  pathName selection mark tagOrId ?column?
    Sets the selection mark to the node given by tagOrId. This causes the range of entries between the anchor and the mark to be temporarily added to the selection. The selection mark is the end of the selection that is fixed while dragging out a selection with the mouse. The special id mark may be used to refer to the current mark node. If tagOrId refers to a non-existent node, then the mark is ignored. Resetting the mark will unselect the previous range. Setting the anchor finalizes the range.

  pathName selection includes tagOrId ?column?
    Returns 1 if the node given by tagOrId is currently selected, 0 if it isn't.

  pathName selection present
    Returns 1 if any nodes are currently selected and 0 otherwise.

  pathName selection set first ?last? ?column?
    Selects all of the nodes in the range between first and last, inclusive, without affecting the selection state of nodes outside that range.

  pathName selection toggle first ?last? ?column?
    Selects/deselects nodes in the range between first and last, inclusive, from the selection. If a node is currently selected, it becomes deselected, and visa versa.

pathName show ?flags? tagOrId...
  Un-hide nodes matching the criteria given by flags. If no tagOrId are given, traverses entire tree. The flags are the same as for the hide command.

pathName sort ?operation? args...

  pathName sort auto ?boolean
    Turns on/off automatic sorting of node entries. If boolean is true, entries will be automatically sorted as they are opened, closed, inserted, or deleted. If no boolean argument is provided, the current state is returned.

  pathName sort cget option
    Returns the current value of the configuration option given by option. Option may have any of the values accepted by the configure operation described below.

  pathName sort configure ?option? ?value option value ...?
    Query or modify the sorting configuration options of the widget. If no option is specified, returns a list describing all of the available options for pathName (see Tk_ConfigureInfo for information on the format of this list). 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 sorting option(s) to have the given value(s); in this case the command returns an empty string. Option and value are described below:

    -column string
      Specifies the column to sort. Entries in the widget are rearranged according to this column. If column is "" then no sort is performed.

    -command string
      Specifies a Tcl procedure to be called when sorting nodes. The procedure is called with three arguments: the pathname of the widget and the fields of two entries. The procedure returns 1 if the first node is greater than the second, -1 is the second is greater, and 0 if equal.

    -decreasing boolean
      Indicates to sort in ascending/descending order. If boolean is true, then the entries as in descending order. The default is no.

    -mode string
      Specifies how to compare entries when sorting. String may be one of the following:

    -setflat bool
      Used by SortColumn to remember if tree was forced to flat by a sort.

      ascii
        Use string comparison based upon the ASCII collation order.

      dictionary
        Use dictionary-style comparison. This is the same as ascii except (a) case is ignored except as a tie-breaker and (b) if two strings contain embedded numbers, the numbers compare as integers, not characters. For example, "bigBoy" sorts between "bigbang" and "bigboy", and "x10y" sorts between "x9y" and "x11y".

      integer
        Compares fields as integers.

      real
        Compares fields as floating point numbers.

      command
        Use the Tcl proc specified by the -command option to compare entries when sorting. If no command is specified, the sort reverts to dictionary sorting.

  pathName sort once ?flags? tagOrId...
    Sorts the children for each entries specified by tagOrId. By default, entries are sorted by name, but you can specify a Tcl proc to do your own comparisons.

    -recurse
      Recursively sort the entire branch, not just the children.

pathName style operation ?args?
  Styles control how data is to be rendered by the widget. They are created with the create subcommands (described below) A default style name text is builtin. It is of type textbox and is used as the default style for columns. Styles may also be applied to entries, individual cells or widget options. For example, the -altstyle option applies a style to every second visible row entry while the -levelstyles option can specify a different style for each node level.

  The following operations are available for treeview styles.

  pathName style activate entry column
    Turns on/off highlighting for a particular style. This is only partially implemented.

  pathName style cget stylename option
    Returns the current value of the configuration option given by option. Option may have any of the values accepted by the configure operation described below.

  pathName style configure ?stylename 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 (see Tk_ConfigureInfo for information on the format of this list). 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 and value are described below:

  pathName style create ...?
    Create a named style. For a full list of style options, see the section STYLE OPTIONS below.

    pathName style create barbox stylename ?option value option value ...?
      A barbox displays numeric data plus a progressbar.

    pathName style create checkbox stylename ?option value option value ...?
      A checkbox style displays boolean or 2-valued data.

    pathName style create combobox stylename ?option value option value ...?
      A combobox style displays multi-valued data.

    pathName style create textbox stylename ?option value option value ...?
      A textbox style displays general text data.

    pathName style create windowbox ?stylename? ?option value option value ...?
      The special style windowbox suports embedding subwindows within data cells.

  pathName style find stylename ?column? ?node? ...
    Get all entries with the given style for a given column in the given nodes. When no column is given, looks in entry and data columns. Duplicates are not eliminated. cell.

  pathName style forget stylename ...
    Eliminates one or more style names whose reference count is zero (i.e. no one else is using it). Requests to delete text or styles that are still in use are quietly ignored.

  pathName style get column tagorid
    Return the style(s) for column and nodes. cell.

  pathName style highlight stylename ?on|off?
    Turns on/off highlighting for a particular style. Used primarily for columns.

  pathName style names
    Lists the names of all the current styles in the treeview widget.

  pathName style set stylename column node ...
    Sets a style for a given column for all the ids given. If column is the tree, sets the entry style, otherwise sets the style in the data column, thus setting the style for a single cell in an entry. The style name may be an empty string to unset the style. Cells that do not have a value may not have a style set and so are silently ignored. The number of cells that actually get set with a style is returned.

  pathName style slaves ?-col col? ?-id node? ?-style styleName? ?-visible bool? ?-info path?
    With no arguments, lists all embedded window slaves. The -col argument shows only windows in the given column. The -id argument shows only windows for the given entry. The -style argument shows only windows with the given style. The -visible argument shows only windows that are visible or invisible. The -info argument dumps all information for a single window.

pathName tag operation args
  Tags are a general means of selecting and marking nodes in the tree. A tag is just a string of characters, and it may take any form except that of an integer. The same tag may be associated with many different nodes.

  Both operation and its arguments determine the exact behavior of the command. The operations available for tags are listed below.

  pathName tag add string ?id...?
    Adds the tag string to one of more entries. If no nodes are given, just creates the tag.

  pathName tag delete string tagnode...
    Deletes the tag string from one or more entries.

  treeName tag exists string ?id?
    If an id is given, return 1 (or 0) if entry has (or hasn't) the tag. Otherwise, returns 1 if at least one entry has tag string.

  pathName tag forget string
    Removes the tag string from all entries. It's not an error if no entries are tagged as string.

  pathName tag names ?id?
    Returns a list of tags used. If an id argument is present, only those tags used by the node designated by id are returned.

  pathName tag nodes name ?name ...?
    Returns a list of ids that have any of the name tags. If no node is tagged as name, then an empty list is returned.

pathName toggle tagnode
  Opens or closes the node given by tagOrId. If the corresponding -opencommand or -closecommand option is set, then that command is also invoked.

pathName xview args
  This command is used to query and change the horizontal position of the information in the widget's window. It can take any of the following forms:

  pathName xview
    Returns a list containing two elements. Each element is a real fraction between 0 and 1; together they describe the horizontal span that is visible in the window. For example, if the first element is .2 and the second element is .6, 20% of the treeview widget's text is off-screen to the left, the middle 40% is visible in the window, and 40% of the text is off-screen to the right. These are the same values passed to scrollbars via the -xscrollcommand option.

  pathName xview tagOrId
    Adjusts the view in the window so that the character position given by tagOrId is displayed at the left edge of the window. Character positions are defined by the width of the character 0.

  pathName xview moveto fraction
    Adjusts the view in the window so that fraction of the total width of the treeview widget's text is off-screen to the left. fraction must be a fraction between 0 and 1.

  pathName xview scroll number what
    This command shifts the view in the window left or right according to number and what. Number must be an integer. What must be either units or pages or an abbreviation of one of these. If what is units, the view adjusts left or right by number character units (the width of the 0 character) on the display; if it is pages then the view adjusts by number screenfuls. If number is negative then characters farther to the left become visible; if it is positive then characters farther to the right become visible.

pathName yview ?args?
  This command is used to query and change the vertical position of the text in the widget's window. It can take any of the following forms:

  pathName yview
    Returns a list containing two elements, both of which are real fractions between 0 and 1. The first element gives the position of the node at the top of the window, relative to the widget as a whole (0.5 means it is halfway through the treeview window, for example). The second element gives the position of the node just after the last one in the window, relative to the widget as a whole. These are the same values passed to scrollbars via the -yscrollcommand option.

  pathName yview tagOrId
    Adjusts the view in the window so that the node given by tagOrId is displayed at the top of the window.

  pathName yview moveto fraction
    Adjusts the view in the window so that the node given by fraction appears at the top of the window. Fraction is a fraction between 0 and 1; 0 indicates the first node, 0.33 indicates the node one-third the way through the treeview widget, and so on.

  pathName yview scroll number what
    This command adjusts the view in the window up or down according to number and what. Number must be an integer. What must be either units or pages. If what is units, the view adjusts up or down by number lines; if it is pages then the view adjusts by number screenfuls. If number is negative then earlier nodes become visible; if it is positive then later nodes become visible.

### TREEVIEW EDITING

A column of data is editable when its -edit option is set to True For column 0, edit changes an entries -label option. For all other columns, edit will update the -data fields. Tree data traces can also be used for edit control. Most of the following applies to textbox styles. However, combobox and checkbox also generate <<TreeViewEditStart/End>> events while barbox and windowbox are not editable.

Text editing is aborted with <Escape> and finished with <Return>. A newline may be inserted with a <Control-r>. Native Tk widgets are now used for builtin editing, using the path $w.edit. By default an entry widget will be used, however, column editing options can be changed via -editopts and -validatecmd. Moreover, columns with a combobox style can provide popup list of options in a listbox using the following style options: -choices, -choicecmd -choiceicons Two virtual events can be used to gain control the during edit: <<TreeViewEditStart>> and <<TreeViewEditEnd>>. The column index is passed in %x, and the entry-row index is passed in %y. eg.

    treeview .t
    bind .t <<TreeViewEditStart>> {EditStart %W %x %y}
    bind .t <<TreeViewEditEnd>> {EditEnd %W %x %y}

These gain control at the start and end of editing respectively, and are general alternatives to -editopts -startcmd and -endcmd. For further details see EditCell in $blt_library/treeview.tcl.

### TREEVIEW OPTIONS

In addition to the configure operation, widget configuration options may also be set by the Tk option command. The class resource name is TreeView.

    option add *TreeView.Foreground white
    option add *TreeView.Background blue

The following widget options are available:

-activeicons images
  Specifies images to be displayed for an entry's icon when it is active. Images is a list of two Tk images: the first image is displayed when the node is open, the second when it is closed.

-activeleaficons images
  Specifies images to be displayed for an leaf entry's icon when it is active. Images is a list of two Tk images: the first image is displayed when the node is open, the second when it is closed.

-allowduplicates boolean
  If boolean is true, allow nodes with duplicate pathnames when inserting new nodes. Otherwise flag an error. The default is no.

-altstyle stylename
  Set a style to use on every other row. This provides a simple way to implement alternating row colors without explicitly setting entry options.

-autocreate boolean
  If boolean is true, automatically create missing ancestor nodes when inserting new nodes. Otherwise flag an error. The default is no.

-background color
  Sets the background color of the widget. The default is white.

-borderwidth pixels
  Sets the width of the 3-D border around the outside edge of the widget. The -relief option determines if the border is to be drawn. The default is 2.

-button string
  Indicates whether a entries should display button. If set to anything other than the default of auto, buttons will not be displayed.

-closecommand string
  Specifies a Tcl script to be invoked when a node is closed. You can overrider this for individual entries using the entry's -closecommand option. The default is "". Percent substitutions are performed on string before it is executed. The following substitutions are valid:

  %W
    The pathname of the widget.

  %p
    The name of the node.

  %P
    The full pathname of the node.

  %#
    The id of the node.

  %%
    Translates to a single percent.

-columnshowhighlight bool
  Enable display highlight color when column activated. Default is false.

-cursor cursor
  Specifies the widget's cursor. The default cursor is "".

-dashes number
  Sets the dash style of the horizontal and vertical lines drawn connecting entries. Number is the length in pixels of the dashes and gaps in the line. If number is 0, solid lines will be drawn. The default is 1 (dotted).

-emptystyle stylename
  Set a style to be used for empty cells.

-entryshowhighlight bool
  Enable display highlight color when entry activated. Default is false.

-exportselection boolean
  Indicates if the selection is exported. If the widget is exporting its selection then it will observe the standard X11 protocols for handling the selection. Selections are available as type STRING; the value of the selection will be the label of the selected nodes, separated by newlines. The default is no.

-fillnull boolean
  Indicates that empty data columns are to be drawn anyways, and to apply the -nullstyle if defined. Turning this off will leave unsightly gaps where attributes (eg. background and underline) were normally expected to be displayed. The default is yes.

-flat boolean
  Indicates whether to display the tree as a flattened list. If boolean is true, then the hierarchy will be a list of full paths for the nodes. Hide and show are not supported in flat mode. This option also has affect on sorting. See the for more information. The default is no.

-focusdashes dashList
  Sets the dash style of the outline rectangle drawn around the entry label of the node that current has focus. Number is the length in pixels of the dashes and gaps in the line. If number is 0, a solid line will be drawn. The default is 1.

-focusforeground color
  Sets the color of the focus rectangle. The default is black.

-focusheight value
  Set the height in pixels to reserve for focus highlighting above and below the line. The default is 1, but setting this to 0 will result in a more compact display.

-font fontName
  Specifies the font for entry labels. You can override this for individual entries with the entry's -font configuration option. The default is *-Helvetica-Bold-R-Normal-*-12-120-*.

-foreground color
  Sets the text color of entry labels. You can override this for individual entries with the entry's -foreground configuration option. The default is black.

-height pixels
  Specifies the requested height of widget. The default is 400.

-hidedataicons boolean
  If boolean is true, it indicates that data column icons (set via styles) should not be displayed. The default is no.

-hidedatatext boolean
  If boolean is true, it indicates that that data column text should not be displayed. The default is no.

-hideicons boolean
  If boolean is true, it indicates that tree column icons should not be displayed. The default is no.

-hideleaves boolean
  If boolean is true, it indicates that no leaves should be displayed. The default is no.

-hideroot boolean
  If boolean is true, it indicates that no entry for the root node should be displayed. The default is no.

-highlightbackground color
  Specifies the normal color of the traversal highlight region when the widget does not have the input focus.

-highlightcolor color
  Specifies the color of the traversal highlight rectangle when the widget has the input focus. The default is black.

-highlightthickness pixels
  Specifies the width of the highlight rectangle indicating when the widget has input focus. The value may have any of the forms acceptable to Tk_GetPixels. If the value is zero, no focus highlight will be displayed. The default is 2.

-icons images
  Specifies images for the entry's icon. Images is a list of two Tk images: the first image is displayed when the node is open, the second when it is closed.

-imagecmd scriptcmd
  Specifies a command to call the first time an image is displayed. This handles all images used in any of the -images, -*icon, and -*icons options. Percent substitutions is performed on scriptcmd as per find -exec, with the image name being used as the value (%V). The main use of -imagecmd is to defer loading images until they become visible for the first time. Typically this means icons options are set with blank images which as they become visible the callback replaces with a real image.

-inlinedata bool
  Enables that data column values that start with a @ and are a list of length 2, are to be interpreted as an inline style or image name. If value is the name of an image, a style is created using the name of image with -icon set to that image. A style is applied to the cell in the manner of style set. Default is true.

-insertfirstnum
  Upon inserts use forward search of tree label for num elements, then fall back to a reverse search. The default is 1, which provides for very fast insertions at the begining or near the end of really long trees. Set to -1 for forward search only, for example, if using -allowduplicates.

-leaficons images
  Specifies images for a leaf entry's icons. Images is a list of two Tk images: the first image is displayed when the node is open, the second when it is closed.

-levelpad pixels
  Indentation to add when displaying sub-tree levels.

-levelstyles stylenames
  Set a list of styles to use for entries at a given level. The first style is used for entries at level 1, the second for level 2, etc. This provides a simple way to specify colors for entries at a given level without explicitly setting entry options.

-linecolor color
  Sets the color of the connecting lines drawn between entries. The default is black.

-linespacing pixels
  Sets the number of pixels spacing between entries. The default is 0.

-linewidth pixels
  Set the width of the lines drawn connecting entries. If pixels is 0, no vertical or horizontal lines are drawn. The default is 1.

-minheight pixels
  Set the minimum height for entries. Default is 0.

-nextautonum
  For inserts at the root node, the start number for the next #auto insert. This is automatically incremented at each insert which speeds up bulk #auto inserts.

-nextsubautonum
  For inserts not into the root node, the number the next child #auto insert starts it's search from. The default is 1.

-newtags boolean
  If boolean is true, when sharing a tree object (see the -tree option), don't share its tags too. The default is 0.

-noautocloseleaf boolean
  If boolean is true, then opening a leaf node will leave it in open mode. The default is false, which automatically sets the mode of a leaf node back to closed without invoking -closecommand.

-nofocusselectbackground color
  Background select color when focus lost.

-nofocusselectforeground color
  Foreground select color when focus lost.

-openanchor string
  When a node with children is opened, defines the -anchor used to the see sub-command. Must be one of: n c s. The default is c.

-opencommand string
  Specifies a Tcl script to be invoked when a node is open. You can override this for individual entries with the entry's -opencommand configuration option. The default is "". Percent substitutions are performed on string before it is executed. The following substitutions are valid:

  %W
    The pathname of the widget.

  %p
    The name of the node.

  %P
    The full pathname of the node.

  %#
    The id of the node.

  %%
    Translates to a single percent.

-relief relief
  Specifies the 3-D effect for the widget. Relief specifies how the treeview widget should appear relative to widget it is packed into; for example, raised means the treeview widget should appear to protrude. The default is sunken.

-resizecursor string
  Cursor to use on resize.

-rootnode num
  Specifiy the node number that is to be the root. This allows a subtree to appear as the root. Multiple treeviews may share a tree with different root nodes, and thus supporting subviews. Default is 0.

-scrollmode mode
  Specifies the style of scrolling to be used. There are three different modes of scrolling: listbox, canvas, and hierbox. In listbox mode, the last entry can always be scrolled to the top of the widget. In hierbox mode, the last entry is always drawn at the bottom of the widget. The default is hierbox.

  listbox
    Like the listbox widget, the last entry can always be scrolled to the top of the widget window. This allows the scrollbar thumb to shrink as the last entry is scrolled upward.

  hierbox
    Like the hierbox widget, the last entry can only be viewed at the bottom of the widget window. The scrollbar stays a constant size.

  canvas
    Like the canvas widget, the entries are bound within the scrolling area.

-scrolltile bool
  Specifies if tiling should scroll with widget. The default is false.

-selectbackground color
  Sets the background color selected node entries. The default is #ffffea.

-selectborderwidth pixels
  Sets the width of the raised 3-D border drawn around the labels of selected entries. The default is 0.

-selectcommand string
  Specifies a Tcl script to invoked when the set of selected nodes changes. The default is "".

-selectforeground color\fB
  Sets the color of the labels of selected node entries while the widget has focus. The default is black.

-selectmode mode
  Specifies the selection mode. If mode is single, only one node can be selected at a time. If multiple more than one node can be selected. If none no selection is displayed. If cell or multicell then selection is for cells rather than whole nodes (rows). The default is single.

-selectrelief relief
  Specifies the 3-D effect of the selected text in the edit window. Relief indicates how the text should appear relative to the edit window; for example, raised means the text should appear to protrude. The default is flat.

-selecttile image
  Set a tile background image to use for selection.

-separator string
  Specifies the character sequence to use when spliting the path components. The separator may be several characters wide (such as "::") Consecutive separators in a pathname are treated as one. If string is the empty string, the pathnames are Tcl lists. If string is the none, no splitting will is done. Each element is a path component. The default is "".

-showfull boolean
  Show full path name when in -flat mode. The default is true.

-showtitles boolean
  If boolean is false, column titles are not be displayed. The default is yes.

-sortselection boolean
  If boolean is true, nodes in the selection are ordered as they are currently displayed (depth-first or sorted), not in the order they were selected. The default is no.

-stylecommand string
  Specifies a Tcl command to call when handling data of the form a @style string. The called command is expected to create the new style. This overrides the default behavior of creating a style with the same name as the image passed after the @ sign (see the -inlinedata option). The call performs the same substitutions as -exec option of the find command.

-substyle stylename
  Set a style for use with the -sublabel. Note: you can hide all sublabels by using a style with the -hide option set.

-takefocus focus
  Provides information used when moving the focus from window to window via keyboard traversal (e.g., Tab and Shift-Tab). If focus is 0, this means that this window should be skipped entirely during keyboard traversal. 1 means that the this window should always receive the input focus. An empty value means that the traversal scripts make the decision whether to focus on the window. The default is "1".

-tile image
  Set background tile image.

-titlefont font
  Font to use for titles.

-titlepad N
  Pad to add above and below title.

-tree tree
  Use an externally created data tree object. Using a tree command facilitates data access, tracing, and loading/saving. eg.

      set t [tree create]
        set n 0
        while {[incr n]<30000} {
           $t insert end -data {A 0 B 0}
        }
        pack [treeview .tv -tree $t]
        .tv column insert end A B

-trim string
  Specifies a string leading characters to trim from entry pathnames before parsing. This only makes sense if the -separator is also set. The default is "".

-underline height
  Draw an underline of the given height below each entry across its entire width. Use in conjunction with column reliefs this provides a grid like effect. The default height is 0.

-width pixels
  Sets the requested width of the widget. If pixels is 0, then the with is computed from the contents of the treeview widget. The default is 200.

-xscrollcommand string
  Specifies the prefix for a command used to communicate with horizontal scrollbars. Whenever the horizontal view in the widget's window changes, the widget will generate a Tcl command by concatenating the scroll command and two numbers. If this option is not specified, then no command will be executed.

-xscrollincrement pixels
  Sets the horizontal scrolling distance. The default is 20 pixels.

-yscrollcommand string
  Specifies the prefix for a command used to communicate with vertical scrollbars. Whenever the vertical view in the widget's window changes, the widget will generate a Tcl command by concatenating the scroll command and two numbers. If this option is not specified, then no command will be executed.

-yscrollincrement pixels
  Sets the vertical scrolling distance. The default is 20 pixels.

### ENTRY OPTIONS

Many widget configuration options have counterparts in entries. For example, there is a -closecommand configuration option for both widget itself and for individual entries. Options set at the widget level are global for all entries. If the entry configuration option is set, then it overrides the widget option. This is done to avoid wasting memory by replicated options. Most entries will have redundant options.

There is no resource class or name for entries.

-activeicons images
  Specifies images to be displayed as the entry's icon when it is active. This overrides the global -activeicons configuration option for the specific entry. Images is a list of two Tk images: the first image is displayed when the node is open, the second when it is closed.

-bindtags tagList
  Specifies the binding tags for nodes. TagList is a list of binding tag names. The tags and their order will determine how events are handled for nodes. Each tag in the list matching the current event sequence will have its Tcl command executed. The default value is all.

-button string
  Indicates whether a button should be displayed on the left side of the node entry. String can be yes, no, or auto. If auto, then a button is automatically displayed if the node has children. This is the default.

-closecommand string
  Specifies a Tcl script to be invoked when the node is closed. This overrides the global -closecommand option for this entry. The default is "". Percent substitutions are performed on string before it is executed. The following substitutions are valid:

  %W
    The pathname of the widget.

  %p
    The name of the node.

  %P
    The full pathname of the node.

  %#
    The id of the node.

  %%
    Translates to a single percent.

-data list
  Initializes or change data fields for the node. List is a list of name-value pairs to be set. Note, this can not be used to unset or forget values for columns, meaning an empty list does nothing. For unsetting use entry unset. The default is "".

-font fontName
  Sets the font for entry labels. This overrides the widget's -font option for this node. The default is *-Helvetica-Bold-R-Normal-*-12-120-*.

-forcetree bool
  Force node to be treated as a tree, even if it has no children. This differs from -button above in that all drawing and querying aspects of the node are treated as a tree. This option is useful primarily for deferring loading until a tree is opened. The default is false.

-foreground color
  Sets the text color of the entry label. This overrides the widget's -foreground configuration option. The default is "".

-height num
  Set height for entry.

-hide bool
  Hide the entry.

-icons images
  Specifies images to be displayed for the entry's icon. This overrides the global -icons configuration option. Images is a list of two Tk images: the first image is displayed when the node is open, the second when it is closed.

-label string
  Sets the text for the entry's displayed label. If set to "", the label of the tree node is displayed The default is "" (see entry relabel).

-opencommand string
  Specifies a Tcl script to be invoked when the entry is opened. This overrides the widget's -opencommand option for this node. The default is "". Percent substitutions are performed on string before it is executed. The following substitutions are valid:

  %W
    The pathname of the widget.

  %p
    The name of the node.

  %P
    The full pathname of the node.

  %#
    The id of the node.

  %%
    Translates to a single percent.

-shadow color
  Set shadow color for text.

-state value
  Set the state of the entry where value is one of: normal, active, disabled. The default state is normal. When the state is set to disabled, the text color displays using -disabledforeground and the node ignores any attempted open or close.

-style stylename
  Set the style to use for the entry. This will override the column style, just as style set will override an entry style. This is useful mostly for seting bg/fg/font for a row. Other options may or may not do nothing. Note, setting icon in a style will apply to all value columns, but not the tree column.

-sublabel string
  Sets the text for the entry's sub-label to be displayed to the right of the nodes -label value. This is rendered using the -substyle style.

-underline num
  Character to underline in an entries text label. Default is -1.

-userdata list
  Extra space available for storing user data.

### BUTTON OPTIONS

Button configuration options may also be set by the option command. The resource subclass is Button. The resource name is always button.

    option add *TreeView.Button.Foreground white
    option add *TreeView.button.Background blue

The following are the configuration options available for buttons.

-activebackground color
  Sets the background color of active buttons. A button is made active when the mouse passes over it or by the button activate operation.

-activeforeground color
  Sets the foreground color of active buttons. A button is made active when the mouse passes over it or by the button activate operation.

-background color
  Sets the background of the button. The default is white.

-borderwidth pixels
  Sets the width of the 3-D border around the button. The -relief option determines if a border is to be drawn. The default is 1.

-closerelief relief
  Specifies the 3-D effect for the closed button. Relief indicates how the button should appear relative to the widget; for example, raised means the button should appear to protrude. The default is solid.

-cursor cursor
  Sets the widget's cursor. The default cursor is "".

-foreground color
  Sets the foreground color of buttons. The default is black.

-images images
  Specifies images to be displayed for the button. Images is a list of two Tk images: the first image is displayed when the button is open, the second when it is closed. If the images is the empty string, then a plus/minus gadget is drawn. The default is "".

-openrelief relief
  Specifies the 3-D effect of the open button. Relief indicates how the button should appear relative to the widget; for example, raised means the button should appear to protrude. The default is flat.

-size pixels
  Sets the requested size of the button. The default is 0.

### STYLE OPTIONS

Five types of styles are defined: textbox, combobox, checkbox, barbox, windowbox. A barbox provides a progressbar for the values of cells, and accepts any data that begins with a numeric (eg. "34%"). The special style windowbox supports embedded subwindows within data cells.

The resource subclass is the name of the style, titlized, ie.

    option add *TreeView.TextBoxStyle.tvBackground white
    option add *TreeView.ComboBoxStyle.tvBackground green
    option add *TreeView.CheckBoxStyle.tvBackground blue

A default textbox style text comes predefined and is set for each columns -style option. Styles may also be associated with entry-rows and/or cells, as follows:

    treeview .t -width 300 -height 200
    pack .t -fill both -expand y
     .t col insert end Size Age Weight
     .t style create combobox MyStyle0 -bg red
     .t style create textbox MyStyle1 -bg blue
     .t style create textbox MyStyle2 -bg green
     .t style create textbox MyStyle3 -bg orange

     .t col conf Size -style MyStyle0
     foreach i {Able Baker Charlie} {
      .t insert end $i -data {Size 1 Age 2 Weight 3}
     }
     .t entry conf 2 -style MyStyle2
     .t style set MyStyle3 Weight 3
     .t insert end Empty
     .t conf -emptystyle MyStyle1

See also the widget options -altstyle, -emptystyle and -levelstyles. The following are available for all but the windowbox type. Note, some of these options are utilized only in particular contexts:

-activebackground color
  Specifies the active background color of a style. Alias is -activebg.

-activeforeground color
  Specifies the active foreground color of a style. Alias is -activefg.

-background color
  Background color override. Default is empty.

-cursor cursorname
  Specifies the cursor of a style. This cursor for the widget when an element is activated.

-font fontName
  Sets the font for a style.

-foreground color
  Specifies the foreground color of a style. Alias is -fg.

-gap N
  Specifies the gap.

-hide bool
  Values or subtext having a style with hide on are to be hidden. Columns and entries are unaffected.

-highlightbackground color
  Specifies the highlight background color of a style. Alias is -highlightbg.

-highlightforeground color
  Specifies the highlight foreground color of a style. Alias is -highlightfg.

-icon name
  Specifies the icon.

-priority N
  Specifies a priority for the style. Higher priorities are used for overriding bg/fg/font. The default 0.

-shadow shadow
  Set shadow.

-tile img
  Set tiling.

The following additional configuration options are available for textbox:

-formatcmd scriptcmd
  Command called to format the displayed key-data value. Percent substitutions are performed on scriptcmd as per find -exec. The called command returns the value to be displayed.

-iconside N
  Specifies which side of the text the icon is placed. Default is left.

-side N
  Specifies which side of cell to anchor contents. Default is top.

The following additional configuration options are available for combobox:

-borderwidth pixel
  Size of border.

-buttonborderwidth pixel
  Size of buttons border

-buttonrelief relief
  Relief of button.

-choicecmd cmd
  Command called to get the list of choices for editing, after the following substitutions: %X %Y %C %# %W %%. Used by the library proc blt::tv::EditCell which implements builtin editing.

-choices lst
  A list of choices for editing.

The following additional configuration options are available for checkbox:

-boxcolor color
  Color of box.

-boxsize num
  Size of box.

-checkcolor color
  Color of check.

-fillcolor color
  Color of fill.

-linewidth num
  Line size.

-offvalue val
  Value representing off.

-onvalue val
  Value representing on.

-showvalue bool
  Show value as well..

The following additional configuration options are available for barbox:

-barbg color
  Color for the background of the bar. Default is the empty string.

-boxcolor color
  Color of box around bar.

-barfg color
  Color for the foreground of the bar. Default is green.

-barheight num
  Height of bar. Default 10.

-barwidth num
  Width of bar. Default 80.

-filltile tile
  Image to tile-fill bar with.

-formatcmd scriptcmd
  Command called to format the displayed value. Percent substitutions are performed on scriptcmd as per find -exec. The called command returns the value to be displayed.

-linewidth num
  Width of border around the bar. Default is 1.

-maxvalue val
  The maxiumum value. Default is 100.0.

-minvalue val
  The miniumum value. Default is 0.0.

-showvalue bool
  Show the numeric value.

Only the following configuration options are available with windowbox:

-minheight num
  Minimum height of window. Window height will be taller if the the entry height is greater than num. Default is 0.

-minwidth num
  Minimum width of window. Window width will be wider if the the column width is greater than num. Default is 0.

-windowcmd string
  Command invoked to return window path. The default is an empty string, which means data in the cell contains the pathname of a widget to use. Percent substitutions are performed on string before it is executed. The following substitutions are valid:

  %W
    The pathname of the widget.

  %p
    The name of the node.

  %P
    The full pathname of the node.

  %#
    The id of the node.

  %C
    The column identifier.

  %%
    Translates to a single percent.

### COLUMN OPTIONS

Column configuration options may also be set by the option command. The resource subclass is Column. The resource name is the name of the column.

    option add *TreeView.Column.Foreground white
    option add *TreeView.treeView.Background blue

The following configuration options are available for columns.

-activetitlebackground color
  Active title background color.

-activetitleforeground color
  Active title foreground color.

-autowidth value
  If the maximum width of a column exceeds the given value, then the column width uses this value instead -width. When value is zero or -width is non-zero, has no effect. Allows setting a default column width limit, while still permitting the user to manually resize larger (unlike -max). The default value is 0.

-background color
  Sets the background color of the column. This overrides the widget's -background option. The default is white.

-bindtags string
  Set binding tags for column.

-borderwidth pixels
  Sets the width of the 3-D border of the column. The -relief option determines if a border is to be drawn. The default is 0.

-colorpattern patcolors
  Alter foreground color based on a string match against the cell data value. Pattern/color pairs are specified in patcolors. If the pattern matches, then color becomes the foreground the data cell. This provides a low-overhead way to display different colors depending only on the form of data.

-colorregexp patcolors
  Does the same thing as -colorpattern, except uses regexp instead, and has a lower priority.

-command string
  Set command for use by invoke. This is called everytime the column is selected. For example, sortable columns can be enabled by a setting this to {blt::tv::SortColumn %W %C}, or sort tree children of with {blt::tv::SortTree %W %C}. Note that SortColumn can temporarily change the treeview mode to -flat. The following substitutions are valid:

  %W
    The pathname of the widget.

  %C
    The column identifier.

  %%
    Translates to a single percent.

-edit num
  Indicates if the column's data fields can be edited via the builtin editing facility. If num is True the data fields in the column can be edited. The default is False.

-editopts values
  Sub-option pair settings for the builtin text edit facilty implemented by ::blt::tv::EditCol. By default editing uses a Tk entry widget. However, one using either -auto or -widget herein can modify this behavior. Following is partial documentation: see ::blt::tv::EditCol in $blt_library/treeview.tcl for full details.

  -auto bool
    Automatically use either an entry, spinbox or text as appropriate. The default is to use an entry widget. Text containing newlines will use a text widget. A column with combobox style where -choices or -choicecmd is set will use a spinbox.

  -editcmd cmd
    Command called to get options. Called with 3 args: widget ind col. Returns name/value pairs which are additional options as accepted by -editopts. To indicate that a cell is non-editable, return {-readonly True}.

  -embed bool
    When True the edit window is managed internally via an embedded windowbox style. When false place is used to manage the window. The default is False. An embedded window has advantages but will result in a re-layout at the begin and end of editing. Note: place is always used for the tree column.

  -endcmd cmd
    Command to call at end of edit, after the new value is set. Appends the same 5 args as -validatecmd, ie: widget data olddata ind col.

  -leafs bool
    Limit editing to leafs only. Default is false.

  -nottnull bool
    Do not edit empty fields that have not had data assigned to them. Default is false.

  -opts values
    Options to pass directly to the widget..

  -readonly bool
    Cell is readonly. Do not edit.

  -sel bool
    Value is initially selected in edit window. Default is true.

  -startcmd cmd
    Command to call at start of edit. Called with 3 args: widget ind col.

  -titles bool
    Enable editing of the title label. Default is false.

  -widget wid
    The widget to use. Builtin support types are: spinbox, text, entry. The default is entry.

  -withtag tag
    Edit only if has tag.

  -withouttag tag
    Edit only if does not have tag.

  -wrap value
    Setting for wrap mode when edit window is a text widget. Default is none.

  For general editing control, bind to the <<TreeViewEditStart/End>> virtual events.

-fillcmd scriptcmd
  Support for demand loading of data on display. Command called (after appending entry id) to set the value of a data column cell or the entry label in the case of the tree column. This call occurs only the first time a cells entry is displayed, and is called only for cells that do not have a value/label already set. If an error is raised by the called command, the value will not be set.

-hide boolean
  If boolean is true, the column is not displayed. The default is no.

-justify justify
  Specifies how the column data fields text should be justified within the column. This matters only when the column is wider than the data field to be display. Justify must be left, right, or center. The default is center.

-max size
  Maximum size for column.

-min size
  Minimum size for column.

-pad pad
  Specifies how much padding for the left and right sides of the column. Pad is a list of one or two screen distances. If pad has two elements, the left side of the column is padded by the first distance and the right side by the second. If pad has just one distance, both the left and right sides are padded evenly. The default is 2.

-relief relief
  Specifies the 3-D effect of the column. Relief specifies how the column should appear relative to the widget; for example, raised means the column should appear to protrude. The default is flat.

-ruledashes value
  Set resize rule is dashed.

-scrolltile bool
  Tile image scrolls.

-sortcommand script
  Command to actually compare entries during sort.

-sortmode mode
  Used by scripts to set -mode for sort command (eg. blt::tv::SortColumn).

-state state
  Sets the state of the column. If state is disable then the column title can not be activated nor invoked. The default is normal.

-style stylename
  Set the style to use for column.

-tile image
  Image to tile column with.

-title string
  Sets the title for the column. The default is "".

-titlearrow value
  Forces an arrow to be drawn in the title. The value is one of: left right up down none and defaults to none. This is used when implementing custom sorts as the indicator.

-titlebackground color
  Background for title.

-titleborderwidth size
  Border size.

-titlefont font
  Font for column title.

-titlejustify just
  Side to place title.

-titleforeground color
  Sets the foreground color of the column title. The default is black.

-titlerelief relief
  Relief for title.

-titleshadow color
  Sets the color of the drop shadow of the column title. The default is "".

-titlestyle style
  A style to use for titles.

-width num
  The user requested width for the column.

-underline num
  Character to underline in column title text. Default is -1.

-validatecmd command
  This option provides a command for validating or post processing edits from the builtin column edit feature (enabled with col conf -edit 1). When edit is completing, the this command string is called after appending 5 arguments: window newvalue oldvalue node column. The called command should return newvalue, possibly with modifications. To revert to the original value, just return $oldvalue To continue editing, use return -code return

-weight float
  Weighting to apply extra space.

-width pixels
  Sets the requested width of the column. This overrides the computed with of the column. If pixels is 0, the width is computed as from the contents of the column. The default is 0.

### EMBEDDED WINDOWS

Embedded windows is supported for data columns via the special style type windowbox. A windowbox style can be applied to either columns or cells. Setting a windowbox type style for an entry is silently ignored. When the cell containing a window style is displayed, the subwindow is taken over and managed as a slave (see style slaves). If a given windowbox style does not define -windowcmd, then the cell data is assumed to contain the widget name to use. If that data does not describe a valid window it is silently ignored and displays nothing. If multiple cells try to display the same widget at the same time, only the first one will appear. The normal rules Tk slave window rules about being a child of the parent apply.

### OLD TEXT EDITING OPTIONS

SECTION OBSOLETE.

This section is obsolete and has been replaced with builtin editing using a Tk entry widget. See TREEVIEW EDITING above.

Text edit window configuration options may also be set by the Tk option command. The resource class is TreeViewEditor. The resource name is always edit.

    option add *TreeViewEditor.Foreground white
    option add *edit.Background blue

The following are the configuration options available for the text editing window.

-background color
  Sets the background of the text edit window. The default is white.

-borderwidth pixels
  Sets the width of the 3-D border around the edit window. The -relief option determines if a border is to be drawn. The default is 1.

-exportselection boolean
  Indicates if the text selection is exported. If the edit window is exporting its selection then it will observe the standard X11 protocols for handling the selection. Selections are available as type STRING. The default is no.

-relief relief
  Specifies the 3-D effect of the edit window. Relief indicates how the background should appear relative to the edit window; for example, raised means the background should appear to protrude. The default is solid.

-selectbackground color
  Sets the background of the selected text in the edit window. The default is white.

-selectborderwidth pixels
  Sets the width of the 3-D border around the selected text in the edit window. The -selectrelief option determines if a border is to be drawn. The default is 1.

-selectforeground color
  Sets the foreground of the selected text in the edit window. The default is white.

-selectrelief relief
  Specifies the 3-D effect of the selected text in the edit window. Relief indicates how the text should appear relative to the edit window; for example, raised means the text should appear to protrude. The default is flat.

### DEFAULT BINDINGS

Tk automatically creates class bindings for treeviews that give them Motif-like behavior. Much of the behavior of a treeview widget is determined by its -selectmode option, which selects one of two ways of dealing with the selection.

If the selection mode is single, only one node can be selected at a time. Clicking button 1 on an node selects it and deselects any other selected item.

If the selection mode is multiple, any number of entries may be selected at once, including discontiguous ranges. Clicking Control-Button-1 on a node entry toggles its selection state without affecting any other entries. Pressing Shift-Button-1 on a node entry selects it, extends the selection.

[0]
  The virtual event <<TreeViewFocusEvent>> is generated for each keyboard and mouse initiated change in focus. It is up to the user to determine if the focus actually changed.

[1]
  In extended mode, the selected range can be adjusted by pressing button 1 with the Shift key down: this modifies the selection to consist of the entries between the anchor and the entry under the mouse, inclusive. The un-anchored end of this new selection can also be dragged with the button down.

[2]
  In extended mode, pressing button 1 with the Control key down starts a toggle operation: the anchor is set to the entry under the mouse, and its selection state is reversed. The selection state of other entries isn't changed. If the mouse is dragged with button 1 down, then the selection state of all entries between the anchor and the entry under the mouse is set to match that of the anchor entry; the selection state of all other entries remains what it was before the toggle operation began.

[3]
  If the mouse leaves the treeview window with button 1 down, the window scrolls away from the mouse, making information visible that used to be off-screen on the side of the mouse. The scrolling continues until the mouse re-enters the window, the button is released, or the end of the hierarchy is reached.

[4]
  Mouse button 2 may be used for scanning. If it is pressed and dragged over the treeview widget, the contents of the hierarchy drag at high speed in the direction the mouse moves.

[5]
  If the Up or Down key is pressed, the location cursor (active entry) moves up or down one entry, as does Control-p and Control-n. If the selection mode is browse or extended then the new active entry is also selected and all other entries are deselected. In extended mode the new active entry becomes the selection anchor.

[6]
  In extended mode, Shift-Up and Shift-Down move the location cursor (active entry) up or down one entry and also extend the selection to that entry in a fashion similar to dragging with mouse button 1.

[7]
  The Left and Right keys scroll the treeview widget view left and right by the width of the character 0. Control-Left and Control-Right scroll the treeview widget view left and right by the width of the window.

[8]
  The Prior and Next keys scroll the treeview widget view up and down by one page (the height of the window), as does Control-u and Control-d.

[9]
  The Home and End keys scroll the treeview widget horizontally to the left and right edges, respectively.

[10]
  Control-Home sets the location cursor to the first entry, selects that entry, and deselects everything else in the widget.

[11]
  Control-End sets the location cursor to the last entry, selects that entry, and deselects everything else in the widget.

[12]
  In extended mode, Control-Shift-Home extends the selection to the first entry and Control-Shift-End extends the selection to the last entry.

[13]
  In multiple mode, Control-Shift-Home moves the location cursor to the first entry and Control-Shift-End moves the location cursor to the last entry.

[14]
  The space and Select keys make a selection at the location cursor (active entry) just as if mouse button 1 had been pressed over this entry.

[15]
  In extended mode, Control-Shift-space and Shift-Select extend the selection to the active entry just as if button 1 had been pressed with the Shift key down.

[16]
  In extended mode, the Escape key cancels the most recent selection and restores all the entries in the selected range to their previous selection state.

[17]
  Control-slash selects everything in the widget, except in single and browse modes, in which case it selects the active entry and deselects everything else.

[18]
  Control-backslash deselects everything in the widget, except in browse mode where it has no effect.

[19]
  The F16 key (labelled Copy on many Sun workstations) or Meta-w copies the selection in the widget to the clipboard, if there is a selection.

The behavior of treeview widgets can be changed by defining new bindings for individual widgets or by redefining the class bindings.

#### WIDGET BINDINGS

In addition to the above behavior, the following additional behavior is defined by the default widget class (TreeView) bindings.

<ButtonPress-2>
  Starts scanning.

<B2-Motion>
  Adjusts the scan.

<ButtonRelease-2>
  Stops scanning.

<B1-Leave>
  Starts auto-scrolling.

<B1-Enter>
  Starts auto-scrolling

<KeyPress-Up>
  Moves the focus to the previous entry.

<KeyPress-Down>
  Moves the focus to the next entry.

<Shift-KeyPress-Up>
  Moves the focus to the previous sibling.

<Shift-KeyPress-Down>
  Moves the focus to the next sibling.

<KeyPress-Prior>
  Moves the focus to first entry. Closed or hidden entries are ignored.

<KeyPress-Next>
  Move the focus to the last entry. Closed or hidden entries are ignored.

<KeyPress-Left>
  Closes the entry. It is not an error if the entry has no children.

<KeyPress-Right>
  Opens the entry, displaying its children. It is not an error if the entry has no children.

<KeyPress-space>
  In "single" select mode this selects the entry. In "multiple" mode, it toggles the entry (if it was previous selected, it is not deselected).

<KeyRelease-space>
  Turns off select mode.

<KeyPress-Return>
  Sets the focus to the current entry.

<KeyRelease-Return>
  Turns off select mode.

<KeyPress>
  Moves to the next entry whose label starts with the letter typed.

<KeyPress-Home>
  Moves the focus to first entry. Closed or hidden entries are ignored.

<KeyPress-End>
  Move the focus to the last entry. Closed or hidden entries are ignored.

<Control-a>
  Move to parent of current entry.

<Control-o>
  Open current entry.

<Control-Shift-O>
  Open current entry recursively.

<Double-ButtonRelease-1>
  Edit cell.

<Alt-Double-ButtonRelease-1>
  Edit cell.

<Control-KeyPress-minus>
  Close parent of current entry.

<KeyPress-F1>
  Opens all tree nodes.

<KeyPress-F2>
  Closes all tree nodes (except root).

<KeyPress-F3>
  Toggle flat mode.

<KeyPress-F4>
  Reset all column widths back to 0 allowing autosizing.

<Control-Shift-O>
  Open focus tree node recursively.

<Control-Shift-C>
  Close focus tree node recursively.

#### BUTTON BINDINGS

Buttons have bindings. There are associated with the "all" bindtag (see the entry's -bindtag option). You can use the bind operation to change them.

<Enter>
  Highlights the button of the current entry.

<Leave>
  Returns the button back to its normal state.

<ButtonRelease-1>
  Adjust the view so that the current entry is visible.

#### ENTRY BINDINGS

Entries have default bindings. There are associated with the "all" bindtag (see the entry's -bindtag option). You can use the bind operation to modify them.

<Enter>
  Highlights the current entry.

<Leave>
  Returns the entry back to its normal state.

<ButtonPress-1>
  Sets the selection anchor the current entry.

<Double-ButtonPress-1>
  Toggles the selection of the current entry.

<B1-Motion>
  For "multiple" mode only. Saves the current location of the pointer for auto-scrolling. Resets the selection mark.

<ButtonRelease-1>
  For "multiple" mode only. Sets the selection anchor to the current entry.

<Shift-ButtonPress-1>
  For "multiple" mode only. Extends the selection.

<Shift-Double-ButtonPress-1>
  Place holder. Does nothing.

<Shift-B1-Motion>
  Place holder. Does nothing.

<Shift-ButtonRelease-1>
  Stop auto-scrolling.

<Control-ButtonPress-1>
  For "multiple" mode only. Toggles and extends the selection.

<Control-Double-ButtonPress-1>
  Place holder. Does nothing.

<Control-B1-Motion>
  Place holder. Does nothing.

<Control-ButtonRelease-1>
  Stops auto-scrolling.

<Control-Shift-ButtonPress-1>
  ???

<Control-Shift-Double-ButtonPress-1>
  Place holder. Does nothing.

<Control-Shift-B1-Motion>
  Place holder. Does nothing.

#### COLUMN BINDINGS

Columns have bindings too. They are associated with the column's "all" bindtag (see the column -bindtag option). You can use the column bind operation to change them.

<Enter>
  Highlights the current column title.

<Leave>
  Returns the column back to its normal state.

<ButtonRelease-1>
  Invokes the command (see the column's -command option) if one if specified.

#### COLUMN RULE BINDINGS

<Enter>
  Highlights the current and activates the ruler.

<Leave>
  Returns the column back to its normal state. Deactivates the ruler.

<ButtonPress-1>
  Sets the resize anchor for the column.

<B1-Motion>
  Sets the resize mark for the column.

<ButtonRelease-1>
  Adjust the size of the column, based upon the resize anchor and mark positions.

### QUICKSTART

TreeFill is a utility function to simplify tree data loading from a human-readable string. The string uses line indentation to indicate tree depth. The indentation is in multiples of 4 spaces, relative to the first line. eg.

    pack [treeview .t]
     .t column insert end X Y Z
     blt::tv::TreeFill .t {
         A 1 2 3
         B 4 5 6
             x 7 8 9
             y 10 11 12
                 a 1 2 "Level a"
                 b 1 2 "Level b"
         C 1 2 3
     }
     .t open -trees all
     .t entry conf 0->B->y->a -state disabled

Any column names not defined are generated. To load a table instead of a tree, simply set the -flat option first. eg.

    pack [treeview .t -flat 1]
     .t column conf Col0 -hide 1
     .t column insert end Name Age Sex
     blt::tv::TreeFill .t {
         "Tom Brown" 9 M
         "Mike Small" 8 M
         "Tina Baker" 7 F
     }

### EXAMPLE

The treeview command creates a new widget.

    treeview .h -bg white

A new Tcl command .h is also created. This command can be used to query and modify the treeview widget. For example, to change the background color of the table to "green", you use the new command and the widget's configure operation.

    # Change the background color.
    	.h configure -background "green"

By default, the treeview widget will automatically create a new tree object to contain the data. The name of the new tree is the pathname of the widget. Above, the new tree object name is ".h". But you can use the -tree option to specify the name of another tree.

    # View the tree "myTree".
    	.h configure -tree "myTree"

When a new tree is created, it contains only a root node. The node is automatically opened. The id of the root node is always 0 (you can use also use the special id root). The insert operation lets you insert one or more new entries into the tree. The last argument is the node's pathname.

    # Create a new entry named "myEntry"
    set id [	.h insert end "myEntry"]

This appends a new node named "myEntry". It will positioned as the last child of the root of the tree (using the position "end"). You can supply another position to order the node within its siblings.

    # Prepend "fred".
    set id [	.h insert 0 "fred"]

Entry names do not need to be unique. By default, the node's label is its name. To supply a different text label, add the -label option.

    # Create a new node named "fred"
    set id [	.h insert end "fred" -label "Fred Flintstone"]

The insert operation returns the id of the new node. You can also use the index operation to get this information.

    # Get the id of "fred"
    	.h index "fred"

To insert a node somewhere other than root, use the -at switch. It takes the id of the node where the new child will be added.

    # Create a new node "barney" in "fred".
    	.h insert -at $id end "barney"

A pathname describes the path to an entry in the hierarchy. It's a list of entry names that compose the path in the tree. Therefore, you can also add "barney" to "fred" as follows.

    # Create a new sub-entry of "fred"
    	.h insert end "fred barney"

Every name in the list is ancestor of the next. All ancestors must already exist. That means that an entry "fred" is an ancestor of "barney" and must already exist. But you can use the -autocreate configuration option to force the creation of ancestor nodes.

    # Force the creation of ancestors.
    	.h configure -autocreate yes
    	.h insert end "fred barney wilma betty"

Sometimes the pathname is already separated by a character sequence rather than formed as a list. A file name is a good example of this. You can use the -separator option to specify a separator string to split the path into its components. Each pathname inserted is automatically split using the separator string as a separator. Multiple separators are treated as one.

    .h configure -separator /
    	.h insert end "/usr/local/tcl/bin"

If the path is prefixed by extraneous characters, you can automatically trim it off using the -trim option. It removed the string from the path before it is parsed.

    .h configure -trim C:/windows -separator /
    	.h insert end "C:/window/system"

You can insert more than one entry at a time with the insert operation. This can be much faster than looping over a list of names.

    # The slow way
    foreach f [glob $dir/*] {
        	.h insert end $f
    }
    # The fast way
    eval .h insert end [glob $dir/*]

In this case, the insert operation will return a list of ids of the new entries.

You can delete entries with the delete operation. It takes one or more tags of ids as its argument. It deletes the entry and all its children.

    .h delete $id

Entries have several configuration options. They control the appearance of the entry's icon and label. We have already seen the -label option that sets the entry's text label. The entry configure operation lets you set or modify an entry's configuration options.

    .h entry configure $id -color red -font fixed

You can hide an entry and its children using the -hide option.

    .h entry configure $id -hide yes

More that one entry can be configured at once. All entries specified are configured with the same options.

    .h entry configure $i1 $i2 $i3 $i4 -color brown

An icon is displayed for each entry. It's a Tk image drawn to the left of the label. You can set the icon with the entry's -icons option. It takes a list of two image names: one to represent the open entry, another when it is closed.

    set im1 [image create photo -file openfolder.gif]
    set im2 [image create photo -file closefolder.gif]
    	.h entry configure $id -icons "$im1 $im2"

If -icons is set to the empty string, no icons are display.

If an entry has children, a button is displayed to the left of the icon. Clicking the mouse on this button opens or closes the sub-hierarchy. The button is normally a + or - symbol, but can be configured in a variety of ways using the button configure operation. For example, the + and - symbols can be replaced with Tk images.

    set im1 [image create photo -file closefolder.gif]
    set im2 [image create photo -file downarrow.gif]
    	.h button configure $id -images "$im1 $im2" \
        -openrelief raised -closerelief raised

Entries can contain an arbitrary number of data fields. Data fields are name-value pairs. Both the value and name are strings. The entry's -data option lets you set data fields.

    .h entry configure $id -data {mode 0666 group users}

The -data takes a list of name-value pairs.

You can display these data fields as columns in the treeview widget. You can create and configure columns with the column operation. For example, to add a new column to the widget, use the column insert operation. The last argument is the name of the data field that you want to display.

    .h column insert end "mode"

The column title is displayed at the top of the column. By default, it's is the field name. You can override this using the column's -title option.

    .h column insert end "mode" -title "File Permissions"

Columns have several configuration options. The column configure operation lets you query or modify column options.

    .h column configure "mode" -justify left

The -justify option says how the data is justified within in the column. The -hide option indicates whether the column is displayed.

    .h column configure "mode" -hide yes

Entries can be selected by clicking on the mouse. Selected entries are drawn using the colors specified by the -selectforeground and -selectbackground configuration options. The selection itself is managed by the selection operation.

    # Clear all selections
    	.h selection clear 0 end
    # Select the root node
    	.h selection set 0

The curselection operation returns a list of ids of all the selected entries.

    set ids [	.h curselection]

You can use the get operation to convert the ids to their pathnames.

    set names [eval .h get -full $ids]

If a treeview is exporting its selection (using the -exportselection option), then it will observe the standard X11 protocols for handling the selection. Treeview selections are available as type STRING; the value of the selection will be the pathnames of the selected entries, separated by newlines.

The treeview supports two modes of selection: single and multiple. In single select mode, only one entry can be selected at a time, while multiple select mode allows several entries to be selected. The mode is set by the widget's -selectmode option.

    .h configure -selectmode "multiple"

You can be notified when the list of selected entries changes. The widget's -selectcommand specifies a Tcl procedure that is called whenever the selection changes.

    proc SelectNotify { widget } {
       set ids [	$widget curselection]
    }
    	.h configure -selectcommand "SelectNotify .h"

The widget supports the standard Tk scrolling and scanning operations. The treeview can be both horizontally and vertically. You can attach scrollbars to the treeview the same way as the listbox or canvas widgets.

    scrollbar .xbar -orient horizontal -command ".h xview"
    scrollbar .ybar -orient vertical -command ".h yview"
    	.h configure -xscrollcommand ".xbar set" \
        -yscrollcommand ".ybar set"

Entries can be programmatically opened or closed using the open and close operations respectively.

    .h open $id
    	.h close $id

When an entry is opened, a Tcl procedure can be automatically invoked. The -opencommand option specifies this procedure. This procedure can lazily insert entries as needed.

    proc AddEntries { dir } {
       eval .h insert end [glob -nocomplain $dir/*]
    }
    	.h configure -opencommand "AddEntries %P"

Now when an entry is opened, the procedure AddEntries is called and adds children to the entry. Before the command is invoked, special "%" substitutions (like bind) are performed. Above, %P is translated to the pathname of the entry.

The same feature exists when an entry is closed. The -closecommand option specifies the procedure.

    proc DeleteEntries { id } {
       .h entry delete $id 0 end
    }
    	.h configure -closecommand "DeleteEntries %#"

When an entry is closed, the procedure DeleteEntries is called and deletes the entry's children using the entry delete operation (%# is the id of entry).

### OLD TREEVIEW EDITS

NOTE: This section is OBSOLETE. Native Tk widgets are now used for editing..

When editing the subwidget .edit is available.

pathName.edit operation ?args?
  This operation is used to provide text editing for cells (data fields in a column) or entry labels. It has several forms, depending on operation:

  pathName.edit apply
    Applies the edited buffer, replacing the entry label or data field. The edit window is hidden.

  pathName.edit cancel
    Cancels the editing operation, reverting the entry label or data value back to the previous value. The edit window is hidden.

  pathName.edit cget value
    Returns the current value of the configuration option given by option. Option may have any of the values accepted by the configure operation described below.

  pathName.edit configure ?option value?
    Query or modify the configuration options of the edit window. If no option is specified, returns a list describing all of the available options (see Tk_ConfigureInfo for information on the format of this list). 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 and value are described in the section below.

pathName.edit delete first last
  Deletes the characters in the edit buffer between the two given character positions.

pathName.edit get ?-root? x y

pathName.edit icursor index

pathName.edit index index
  Returns the text index of given index.

pathName.edit insert index string
  Insert the text string string into the edit buffer at the index index. For example, the index 0 will prepend the buffer.

pathName.edit selection args
  This operation controls the selection of the editing window. Note that this differs from the selection of entries. It has the following forms:

  pathName.edit selection adjust index
    Adjusts either the first or last index of the selection.

  pathName.edit selection clear
    Clears the selection.

  pathName.edit selection from index
    Sets the anchor of the selection.

  pathName.edit selection present
    Indicates if a selection is present.

  pathName.edit selection range start end
    Sets both the anchor and mark of the selection.

  pathName.edit selection to index
    Sets the unanchored end (mark) of the selection.

### NOTES

Text cells in display height can be at most 64K pixels high per row.

### KEYWORDS

treeview, widget
Copyright © 1995-1997 Roger E. Critchlow Jr.