treectrl(n) 2.4.1 treectrl "Tk Commands"

Name

treectrl - Create and manipulate hierarchical multicolumn widgets

Table Of Contents

Synopsis

  • package require treectrl 2.4.1

Description

treectrl pathName ?options?

The treectrl command creates a new window (given by the pathName argument) and makes it into a treectrl widget. Additional options, described above, may be specified on the command line or in the option database to configure aspects of the treectrl such as its background color and relief. The treectrl command returns the path name of the new window. At the time this command is invoked, there must not exist a window named pathName, but pathName's parent must exist.

A treectrl is a listbox widget which displays items in a one- or two-dimensional arrangement. Items have a parent-child relationship with other items. Items may be arranged from top-to-bottom or from left-to-right. Items may be spread about one or more columns. Each item-column may be configured to span one or more adjacent item-columns. The visibility of items can be set individually.

Items have a set of states, which are boolean properties. For each column of an item there is a style associated, which determines how to display the item's column taking into account the item's current state set. New states may be defined to further control the appearance of items; these custom states may be turned on or off in individual columns of items.

Multiple rows of column headers are supported. Column headers have platform-native appearance on Windows, Mac OS X, and Gtk+. The appearance of column headers may be customized using styles.

Columns may be rearranged by the user using drag-and-drop. One column can be specified to display the data in a hierarchical structure. The visibility of columns can be set individually.

A treectrl can display a user-resizable selection rectangle called the marquee. Another feature, the drag image, may be used to provide feedback during drag-and-drop operations. Both of these are features commonly found in file browsers.

A treectrl can generate events when various things happen, such as changes to the selection, or a parent item being toggled open or closed. Scripts may be bound to these events. New events can be defined.

A treectrl can display a background image. The background image can be configured to be scrolled and tiled on each axis individually.

STANDARD OPTIONS

-background
-borderwidth
-cursor
-font
-highlightbackground
-highlightcolor
-highlightthickness
-orient
-relief
-takefocus
-xscrollcommand
-yscrollcommand
-foreground

See the option manual entry for details on the standard options.

WIDGET SPECIFIC OPTIONS

Command-Line Switch: -backgroundimage
Database Name: backgroundImage
Database Class: BackgroundImage

Specifies the name of an image to draw as the list background. Other options control whether the image is tiled and whether the image scrolls. If the image is transparent it is drawn on top of any column -itembackground colors.

Command-Line Switch: -backgroundmode
Database Name: backgroundMode
Database Class: BackgroundMode

Specifies how the background color of items is chosen in each column. The value should be one of row, column, order, or ordervisible. The default is row. This option has only an effect for columns which have -itembackground defined as list of two or more colors (see section COLUMNS below for more on this). If row or column is specified, the background color is chosen based on the location of the item in the 1- or 2-dimensional grid of items as layed out on the screen; this layout of items is affected by the -orient and -wrap options as well as item visibility. When order or ordervisible is specified, the background color is chosen based on the result of the item order command, regardless of the layout of items.

Command-Line Switch: -bgimage
Database Name: bgImage
Database Class: BgImage

Synonym for -backgroundimage.

Command-Line Switch: -bgimageanchor
Database Name: bgImageAnchor
Database Class: BgImageAnchor

Specifies how the background image should be aligned in any of the forms acceptable to Tk_GetAnchor. Must be one of the values n, ne, e, se, s, sw, w, nw, or center. The default is nw. When the background image scrolls, the anchor position is relative to the canvas, otherwise it is relative to the contentbox.

Command-Line Switch: -bgimageopaque
Database Name: bgImageOpaque
Database Class: BgImageOpaque

Specifies a boolean indicating whether or not the background image is fully opaque. This is needed because there is no way in Tk to determine whether an image contains transparency or not. The default value is true, so if you use a transparent -backgroundimage you must set this to false.

Command-Line Switch: -bgimagescroll
Database Name: bgImageScroll
Database Class: BgImageScroll

Specifies whether the background image scrolls along with the items or whether it remains locked in place relative to the edges of the window. The value must be a string that contains zero or more of the characters x or y. The default is xy.

Command-Line Switch: -bgimagetile
Database Name: bgImageTile
Database Class: BgImageTile

Specifies whether the background image is tiled along the x and/or y axes. The value must be a string that contains zero or more of the characters x or y. The default is xy.

Command-Line Switch: -buttonbitmap
Database Name: buttonBitmap
Database Class: ButtonBitmap

Specifies the name of a bitmap be used to display the expand/collapse button of an item. This is a per-state option. If a bitmap is specified for a certain item state, it overrides the effects of -usetheme.

Command-Line Switch: -buttoncolor
Database Name: buttonColor
Database Class: ButtonColor

Specifies the foreground color which should be used for drawing the outline and the plus or minus sign of an item's expand/collapse button.

Command-Line Switch: -buttonimage
Database Name: buttonImage
Database Class: ButtonImage

Specifies the name of an image to be used to display the expand/collapse button of an item. This is a per-state option. If an image is specified for a certain item state, it overrides the effects of -buttonbitmap and -usetheme.

Command-Line Switch: -buttonsize
Database Name: buttonSize
Database Class: ButtonSize

Specifies the width and height of the expand/collapse button of an item in any of the forms acceptable to Tk_GetPixels.

Command-Line Switch: -buttonthickness
Database Name: buttonThickness
Database Class: ButtonThickness

Specifies the width of the outline and the plus or minus sign of the expand/collapse button of an item in any of the forms acceptable to Tk_GetPixels.

Command-Line Switch: -buttonttracking
Database Name: buttonTracking
Database Class: ButtonTracking

Specifies a boolean that determines if the expand/collapse buttons are tracked like pushbuttons when clicking them. When true, buttons are not toggled until the <ButtonRelease> event occurs over them. When false, buttons are toggled as soon as the <ButtonPress> event occurs over them. This option defaults to true on Mac OS X and Gtk+, false on Win32 and X11.

Command-Line Switch: -canvaspadx
Database Name: canvasPadX
Database Class: CanvasPadX

Specifies the width of extra whitespace on the left and right edges of the canvas in any of the forms acceptable to Tk_GetPixels. The option value may be a list of one or two screen distances to specify padding for the two edges separately. The default is 0.

Command-Line Switch: -canvaspady
Database Name: canvasPadY
Database Class: CanvasPadY

Specifies the height of extra whitespace on the top and bottom edges of the canvas in any of the forms acceptable to Tk_GetPixels. The option value may be a list of one or two screen distances to specify padding for the two edges separately. The default is 0.

Command-Line Switch: -columnprefix
Database Name: columnPrefix
Database Class: ColumnPrefix

Specifies an ascii string that changes the way column ids are reported and processed. If this option is a non-empty string, the usual integer value of a column id is prefixed with the given string. This can aid debugging but it is important your code doesn't assume column ids are integers if you use it.

Command-Line Switch: -columnproxy
Database Name: columnProxy
Database Class: ColumnProxy

If this option specifies a non empty value, it should be a screen distance in any of the forms acceptable to Tk_GetPixels. Then a 1 pixel thick vertical line will be drawn at the specified screen distance from the left edge of the treectrl widget, which reaches from top to bottom of the treectrl widget and uses an inverting color (i.e black on lighter background, white on darker background). This line can be used to give the user a visual feedback during column resizing.

Command-Line Switch: -columnresizemode
Database Name: columnResizeMode
Database Class: ColumnResizeMode

Specifies the visual feedback used when resizing columns. The value should be one of proxy or realtime. For proxy, a 1-pixel thick vertical line is drawn representing where the right edge of the column will be after resizing. For realtime, the column's size is changed while the user is dragging the right edge of the column. The default is realtime.

Command-Line Switch: -columntagexpr
Database Name: columnTagExpr
Database Class: ColumnTagExpr

Specifies a boolean that enables or disables tag expressions in column descriptions. See ITEM AND COLUMN TAGS.

Command-Line Switch: -defaultstyle
Database Name: defaultStyle
Database Class: DefaultStyle

This option is deprecated; use the column option -itemstyle instead. Specifies a list of styles, one per column, to apply to each item created by the item create command. The number of styles in the list can be different from the number of tree columns. Each list element should be a valid style name or an empty string to indicate no style should be applied to a specific column. The list of styles is updated if a style is deleted or if a column is moved.

Command-Line Switch: -doublebuffer
Database Name: doubleBuffer
Database Class: DoubleBuffer

This option no longer has any effect, but was left in for compatibility. It used to control the amount of double-buffering that was used when displaying a treectrl.

Command-Line Switch: -headerfont
Database Name: headerFont
Database Class: Font

Specifies the font to draw text in column headers with. The default value is TkHeadingFont where available (on Tk 8.5+). This option can be overridden by setting the -font option for individual column headers.

Command-Line Switch: -headerfg
Database Name: headerForeground
Database Class: Foreground

Synonym for -headerforeground.

Command-Line Switch: -headerforeground
Database Name: headerForeground
Database Class: Foreground

Specifies the color to draw text in column headers with. The default value is the Tk button foreground color (usually black). On Gtk+, the system theme may override this color. This option (and the Gtk+ system theme color) can be overridden by setting the -textcolor option for individual column headers.

Command-Line Switch: -height
Database Name: height
Database Class: Height

Specifies the desired height for the window in any of the forms acceptable to Tk_GetPixels. The default is 200 pixels. If this option is less than or equal to zero then the window will not request any size at all.

Command-Line Switch: -indent
Database Name: indent
Database Class: Indent

Specifies the screen distance an item is indented relative to its parent item in any of the forms acceptable to Tk_GetPixels. The default is 19 pixels.

Command-Line Switch: -itemgapx
Database Name: itemGapX
Database Class: ItemGapX

Specifies the horizontal spacing between adjacent items in any of the forms acceptable to Tk_GetPixels. The default is 0.

Command-Line Switch: -itemgapy
Database Name: itemGapY
Database Class: ItemGapY

Specifies the vertical spacing between adjacent items in any of the forms acceptable to Tk_GetPixels. The default is 0.

Command-Line Switch: -itemheight
Database Name: itemHeight
Database Class: ItemHeight

Specifies a fixed height for every item in any of the forms acceptable to Tk_GetPixels. If non-zero, this option overrides the requested height of an item and the -minitemheight option. If an item's own -height option is specified then that is the height used for the item. In any case, items are never shorter than the maximum height of a button if they display one. The default is 0.

Command-Line Switch: -itemprefix
Database Name: itemPrefix
Database Class: ItemPrefix

Specifies an ascii string that changes the way item ids are reported and processed. If this option is a non-empty string, the usual integer value of an item id is prefixed with the given string. This can aid debugging but it is important your code doesn't assume item ids are integers if you use it.

Command-Line Switch: -itemtagexpr
Database Name: itemTagExpr
Database Class: ItemTagExpr

Specifies a boolean that enables or disables tag expressions in item descriptions. See ITEM AND COLUMN TAGS.

Command-Line Switch: -itemwidth
Database Name: itemWidth
Database Class: ItemWidth

Specifies a fixed width for every item in any of the forms acceptable to Tk_GetPixels. If more than one column is visible, then this option has no effect. If the -orient option is vertical, and the -wrap option is unspecified, then this option has no effect (in that case all items are as wide as the column).

Command-Line Switch: -itemwidthequal
Database Name: itemWidthEqual
Database Class: ItemWidthEqual

Specifies a boolean that says whether all items should have the same width. If more than one column is visible, then this option has no effect. If the -orient option is vertical, and the -wrap option is unspecified, then this option has no effect (in that case all items are as wide as the column). If the -itemwidth option is specified, then this option has no effect.

Command-Line Switch: -itemwidthmultiple
Database Name: itemWidthMultiple
Database Class: ItemWidthMultiple

Specifies a screen distance that every item's width will be evenly divisible by in any of the forms acceptable to Tk_GetPixels. If more than one column is visible, then this option has no effect. If the -orient option is vertical, and the -wrap option is unspecified, then this option has no effect (in that case all items are as wide as the column). If the -itemwidth option is specified, then this option has no effect.

Command-Line Switch: -linecolor
Database Name: lineColor
Database Class: LineColor

Specifies the color which should be used for drawing the connecting lines between related items.

Command-Line Switch: -linestyle
Database Name: lineStyle
Database Class: LineStyle

Specifies the appearance of the connecting lines between related items. The value should be dot, which is the default, or solid.

Command-Line Switch: -linethickness
Database Name: lineThickness
Database Class: LineThickness

Specifies the thickness of the connecting lines between related items in any of the forms acceptable to Tk_GetPixels.

Command-Line Switch: -minitemheight
Database Name: minItemHeight
Database Class: MinItemHeight

Specifies a minimum height for every item in any of the forms acceptable to Tk_GetPixels. The default is 0, which means that every item has the height requested by the arrangement of elements in each column. This option has no effect if either the -itemheight widget option or -height item option is specified. In any case, items are never shorter than the maximum height of an expand/collapse button.

Command-Line Switch: -rowproxy
Database Name: rowProxy
Database Class: RowProxy

If this option specifies a non empty value, it should be a screen distance in any of the forms acceptable to Tk_GetPixels. Then a 1 pixel thick horizontal line will be drawn at the specified screen distance from the top edge of the treectrl widget, which reaches from left to right of the treectrl widget and uses an inverting color (i.e black on lighter background, white on darker background). This line can be used to give the user a visual feedback during row resizing.

Command-Line Switch: -scrollmargin
Database Name: scrollMargin
Database Class: ScrollMargin

Specifies a positive screen distance in any of the forms acceptable to Tk_GetPixels. This option is used by the default bindings to determine how close to the edges of the contentbox the mouse pointer must be before scrolling occurs. Specifying a positive value is useful when items may be drag-and-dropped. Defaults to 0.

Command-Line Switch: -selectmode
Database Name: selectMode
Database Class: SelectMode

Specifies one of several styles for manipulating the selection. The value of the option may be arbitrary, but the default bindings expect it to be either single, browse, multiple, or extended; the default value is browse.

Command-Line Switch: -showbuttons
Database Name: showButtons
Database Class: ShowButtons

Specifies a boolean value that determines whether this widget leaves indentation space to display the expand/collapse buttons next to items. The default value is true. The item option -button determines whether an item has a button. See also the widget options -showrootbutton and -showrootchildbuttons.

Command-Line Switch: -showheader
Database Name: showHeader
Database Class: ShowHeader

Specifies a boolean value that determines whether this widget should display the header line with the column names at the top of the widget. The default value is true.

Command-Line Switch: -showlines
Database Name: showLines
Database Class: ShowLines

Specifies a boolean value that determines whether this widget should draw the connecting lines between related items. The default value is true on Win32 and X11, false on Mac OS X and Gtk+.

Command-Line Switch: -showroot
Database Name: showRoot
Database Class: ShowRoot

Specifies a boolean value that determines whether this widget should draw the root item. By suppressing the drawing of the root item the widget can have multiple items that appear as toplevel items. The default value is true.

Command-Line Switch: -showrootbutton
Database Name: showRootButton
Database Class: ShowRootButton

Specifies a boolean value that determines whether this widget leaves indentation space to display the expand/collapse button next to the root item. The default value is false. The item option -button determines whether the root item has a button.

Command-Line Switch: -showrootchildbuttons
Database Name: showRootChildButtons
Database Class: ShowRootChildButtons

Specifies a boolean value that determines whether this widget should draw the expand/collapse buttons next to children of the root item. The default value is true.

Command-Line Switch: -showrootlines
Database Name: showRootLines
Database Class: ShowRootLines

Specifies a boolean value that determines whether this widget should draw the connecting lines between children of the root item. The default value is true.

Command-Line Switch: -treecolumn
Database Name: treeColumn
Database Class: TreeColumn

Specifies a column description that determines which column displays the expand/collapse buttons and connecting lines between items. The default is unspecified.

Command-Line Switch: -usetheme
Database Name: useTheme
Database Class: UseTheme

Specifies a boolean value that determines whether this widget should draw parts of itself using a platform-specific theme manager. The default is true.

Command-Line Switch: -width
Database Name: width
Database Class: Width

Specifies the desired width for the window in any of the forms acceptable to Tk_GetPixels. The default is 200 pixel. If this option is less than or equal to zero then the window will not request any size at all.

Command-Line Switch: -wrap
Database Name: wrap
Database Class: Wrap

Specifies whether items are arranged in a 1- or 2-dimensional layout.

If the value is an empty string (the default), then items are arranged from top to bottom (-orient=vertical) or from left to right (-orient=horizontal) in a 1-dimensional layout.

If the value is "N items", then no more than N items will appear in a vertical group (-orient=vertical) or horizontal group (-orient=horizontal).

If the value is "N pixels", then no vertical group of items will be taller than N pixels (-orient=vertical) or no horizontal group of items will be wider than N pixels (-orient=horizontal).

If the value is window, then a no vertical group of items will be taller than the window (-orient=vertical) or no horizontal group of items will be wider than the window (-orient=horizontal).

It is also possible to cause wrapping to occur on a per-item basis by using the item option -wrap. See the item create command for that option.

Command-Line Switch: -xscrolldelay
Database Name: xScrollDelay
Database Class: ScrollDelay

This option controls how quickly horizontal scrolling occurs while dragging the mouse with button 1 pressed. The value should be a list of 1 or 2 integers interpreted as milliseconds. If 2 values are specified, then the first value determines the intial delay after the first scroll, and the second value determines the delay for all scrolling after the first. If only 1 value is specified, each scroll takes place after that delay.

Command-Line Switch: -xscrollincrement
Database Name: xScrollIncrement
Database Class: ScrollIncrement

Specifies an increment for horizontal scrolling, in any of the usual forms permitted for screen distances. If the value of this option is greater than zero, the horizontal view in the window will be constrained so that the canvas x coordinate at the left edge of the window is always an even multiple of -xscrollincrement; furthermore, the units for scrolling (e.g., the change in view when the left and right arrows of a scrollbar are selected) will also be -xscrollincrement. If the value of this option is less than or equal to zero, then horizontal scrolling snaps to the left of an item, or part of an item if items are wider than the contentbox.

Command-Line Switch: -xscrollsmoothing
Database Name: xScrollSmoothing
Database Class: ScrollSmoothing

Specifies whether scrolling should be done as if -xscrollincrement=1 whenever scrolling is performed by non-unit amounts. When the value of this option is true and the xview command is called to scroll by "units", scrolling occurs according to the -xscrollincrement option, and all other scrolling is done as if the -xscrollincrement option was set to 1. The effect is that when dragging the scrollbar thumb scrolling is very smooth, but when clicking the scrollbar buttons scrolling is done in coarser increments. The default value is false.

Command-Line Switch: -yscrolldelay
Database Name: yScrollDelay
Database Class: ScrollDelay

This option controls how quickly vertical scrolling occurs while dragging the mouse with button 1 pressed. The value should be a list of 1 or 2 integers interpreted as milliseconds. If 2 values are specified, then the first value determines the intial delay after the first scroll, and the second value determines the delay for all scrolling after the first. If only 1 value is specified, each scroll takes place after that delay.

Command-Line Switch: -yscrollincrement
Database Name: yScrollIncrement
Database Class: ScrollIncrement

Specifies an increment for vertical scrolling, in any of the usual forms permitted for screen distances. If the value of this option is greater than zero, the vertical view in the window will be constrained so that the canvas y coordinate at the top edge of the window is always an even multiple of -yscrollincrement; furthermore, the units for scrolling (e.g., the change in view when the top and bottom arrows of a scrollbar are selected) will also be -yscrollincrement. If the value of this option is less than or equal to zero, then vertical scrolling snaps to the top of an item, or part of an item if items are taller than the contentbox.

Command-Line Switch: -yscrollsmoothing
Database Name: yScrollSmoothing
Database Class: ScrollSmoothing

Specifies whether scrolling should be done as if -yscrollincrement=1 whenever scrolling is performed by non-unit amounts. When the value of this option is true and the yview command is called to scroll by "units", scrolling occurs according to the -yscrollincrement option, and all other scrolling is done as if the -yscrollincrement option was set to 1. The effect is that when dragging the scrollbar thumb scrolling is very smooth, but when clicking the scrollbar buttons scrolling is done in coarser increments. The default value is false.

THE CANVAS

Throughout this manual page the term canvas is sometimes used. The canvas can be thought of as the virtual sheet of paper upon which all visible items are drawn. The treectrl window displays different areas of the canvas within its borders as the list is scrolled.

ITEM AND COLUMN TAGS

Columns and items may have any number of tags associated with them. A tag is just a string of characters, and it may take any form, including that of an integer, although the characters '(', ')', '&', '|', '^' and '!' should be avoided.

The same tag may be associated with many columns or items. This is commonly done to group items in various interesting ways; for example, in a file browser all directories might be given the tag "directory".

Tag expressions are used in column descriptions and item descriptions to specify which columns and items to operate on. A tag expression can be a single tag name or a logical expression of tags using operators '&&', '||', '^' and '!', and parenthesized subexpressions. For example:

.t item id "tag {(a && !b) || (!a && b)}"

or equivalently:

.t item id "tag {a ^ b}"

will return the unique ids of any items with either "a" or "b" tags, but not both.

Within a tag expression a tag name may be enclosed in double quotes to avoid special processing of the operator characters. For example:

.t item id {tag {"a&&b"||c}}

will return the unique ids of any items with either "a&&b" or "c" tags; in this example the && is not treated as an operator. A double-quote may be escaped within a quoted tag name using a backslash '\'.

Tag operators may be bypassed completely by setting the -columntagexpr and -itemtagexpr options. This can be useful if your application has column or item tags containing arbitrary text.

.t configure -itemtagexpr false
.t item delete "tag a&&b"

WIDGET COMMAND

The treectrl command creates a new Tcl command whose name is the same as the path name of the treectrl's window. This command may be used to invoke various operations on the widget. It has the following general form:

pathName option ?arg arg ...?

PathName is the name of the command, which is the same as the treectrl widget's path name. Option and the args determine the exact behavior of the command. The following commands are possible for treectrl widgets:

pathName activate itemDesc

Sets the active item to the one described by itemDesc, and switches on the state active for that item. The active item can be referred to by the item description active. If this command changes which item is active an <ActiveItem> event is generated. If the active item is deleted the root item becomes the new active item.

pathName bbox ?area?

Returns a list with four elements giving the bounding box (left, top, right and bottom) of an area of the window. If area is not specified, then the result is the bounding box of the entire window. If area is content, then the result is the part of the window not including borders, headers, or locked columns. If area is header, then the result is the part of the window not including borders where column titles are displayed. If area is left, then the result is the part of the window not including borders or headers where left-locked columns are displayed. If area is right, then the result is the part of the window not including borders or headers where right-locked columns are displayed.

If area is one of header.left, header.none or header.right then the area of the column headers occupied by columns with -lock=left, -lock=none or -lock=right is returned.

An empty string is returned if the display area has no height or width, which can be true for various reasons such as the window is too small, or the header is not displayed, or there aren't any locked columns.

pathName canvasx windowx

Translates the given window x-coordinate windowx in the treectrl to canvas coordinate space. The marquee command expects canvas coordinates.

pathName canvasy windowy

Translates the given window y-coordinate windowy in the treectrl to canvas coordinate space. The marquee command expects canvas coordinates.

pathName cget option

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

pathName collapse ?-recurse? ?itemDesc ...?

Deprecated. Use item collapse instead.

pathName column option column ?arg ...?

This command is used to manipulate the columns of the treectrl widget (see section COLUMNS below). The exact behavior of the command depends on the option argument that follows the column argument. The following forms of the command are supported:

pathName column bbox columnDesc

Returns a list with four elements giving the bounding box of the header of the column specified by the column description columnDesc. The returned coordinates are relative to the top-left corner of the widget. If the column option -visible=false or if the widget option -showheader=false, then an empty list is returned.

pathName column cget columnDesc option

This command returns the current value of the option named option for the column specified by the column description columnDesc, ColumnDesc may also be the string tail to specify the tail column. Option may have any of the values accepted by the column configure widget command.

pathName column configure columnDesc ?option? ?value? ?option value ...?

This command is similar to the configure widget command except that it modifies options associated with the columns specified by the column description columnDesc instead of modifying options for the overall treectrl widget. ColumnDesc may be the string tail to specify the tail column. If columnDesc refers to more than one column, then at least one option-value pair must be given. If no option is specified, the command returns a list describing all of the available options for columnDesc (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 option(s) to have the given value(s) for columnDesc; in this case the command returns an empty string.

See COLUMNS below for details on the options available for columns.

For compatibility with older versions of treectrl (which did not support more than one row of column headers) any of the configuration options mentioned in the HEADERS section, such as -arrow, -text, etc, may be passed to the top header-row through this command.

pathName column compare column1 op column2

For both column descriptions column1 and column2 the index is retrieved (as returned from the column order widget command). Then these indexes are compared using the operator op, which must be either <, <=, ==, >=, >, or !=. The return value of this command is 1 if the comparison evaluated to true, 0 otherwise.

pathName column count ?columnDesc?

If no additional arguments are given, the result is a decimal string giving the number of columns created by the column create widget command which haven't been deleted by the column delete widget command; in this case the tail column is not counted. If columnDesc is given, then the result is the number of columns that match that column description.

pathName column create ?option value ...?

This command creates a new column in the treectrl widget. The new column is placed to the right of all other columns (except the tail column). Any option-value arguments configure the new column according to the column configure command. The return value is the unique identifier of the new column.

pathName column delete first ?last?

Deletes the specified column(s). First and last must be valid column descriptions. If both first and last are specified, then they may refer to a single column only. The tail column cannot be deleted and it is an error to specify it. The order of first and last doesn't matter, and first may be equal to last.

pathName column dragcget option

Deprecated. Use header dragcget instead.

pathName column dragconfigure ?option? ?value? ?option value ...?

Deprecated. Use header dragconfigure instead.

pathName column index columnDesc

Deprecated. Use column id instead.

pathName column id columnDesc

This command resolves the column description columnDesc into a list of unique column identifiers. If the column(s) described by columnDesc don't exist, this command returns an empty list.

pathName column list ?-visible?

This command returns a list of identifiers for every column (except the tail) from left to right. If -visible is given, only columns whose -visible option is true are returned.

pathName column move columnDesc beforeDesc

Moves the column specified by columnDesc to the left of the column specified by beforeDesc. Both columnDesc and beforeDesc must be valid column descriptions. If beforeDesc is the string tail, the column columnDesc will become the last column.

pathName column neededwidth columnDesc

This command returns a decimal string giving the needed width of the column specified by the column description columnDesc. The needed width is the maximum of the width of the column header and the width of the widest style in any visible item.

When an item style or column header spans multiple columns, the needed width of a column is affected by the widths of other columns in the span, in which case the result of this command isn't particularly useful.

pathName column order columnDesc ?-visible?

This command returns a decimal string giving the position of the column specified by the column description columnDesc in the list of columns starting from zero for the leftmost column. If -visible is given, only columns whose -visible option is true are considered, and -1 is returned if columnDesc's -visible option is false.

pathName column tag option ?arg arg ...?

This command is used to manipulate tags on columns. The exact behavior of the command depends on the option argument that follows the column tag argument. The following forms of the command are supported:

pathName column tag add columnDesc tagList

Adds each tag in tagList to the columns specified by the column description columnDesc. Duplicate tags are ignored. The list of tags for a column can also be changed via a column's -tags option.

pathName column tag expr columnDesc tagExpr

Evaluates the tag expression tagExpr against every column specified by the column description columnDesc. The result is 1 if the tag expression evaluates to true for every column, 0 otherwise.

pathName column tag names columnDesc

Returns a list of tag names assigned to the columns specified by the column description columnDesc. The result is the union of any tags assigned to the columns.

pathName column tag remove columnDesc tagList

Removes each tag in tagList from the columns specified by the column description columnDesc. It is not an error if any of the columns do not use any of the tags. The list of tags for a column can also be changed via a column's -tags option.

pathName column width columnDesc

This command returns a decimal string giving the width in pixels of the column specified by the column description columnDesc, even if the treectrl is configured to not display the column headers by means of the -showheader option.

pathName compare itemDesc1 op itemDesc2

Deprecated. Use the item compare command instead.

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 may have any of the values accepted by the treectrl command.

pathName contentbox

Returns a list with four elements giving the bounding box of the screen area used to display items. This is the area of the window not including borders, column headers, or locked columns. An empty string is returned if the display area has no height or width, which can happen if the window is too small. The result of this command is the same as that of bbox content.

pathName debug option ?arg arg ...?

This command is used to facilitate debugging of the treectrl widget. The exact behavior of the command depends on the option argument that follows the debug argument. The following forms of the command are supported:

pathName debug alloc

Returns a string giving partial statistics on memory allocations, if the package was built with TREECTRL_DEBUG defined.

pathName debug cget option

This command returns the current value of the debugging option named option. Option may have any of the values accepted by the debug configure widget command.

pathName debug configure ?option? ?value? ?option value ...?

This command is similar to the configure widget command except that it modifies debugging options instead of modifying options for the overall treectrl widget. If no option is specified, the command returns a list describing all of the available debugging 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 debugging option(s) to have the given value(s); in this case the command returns an empty string.

The following debugging options are supported:

-displaydelay millis

Specifies a time duration in milliseconds, which should be waited after something has been drawn to the screen. Setting this option has only an effect, if the debugging options -enable and -display are switched on.

-data boolean

If this option is switched on (together with the debugging option -enable), at various places a consistence check on the internal data structure is made (e.g. for every item is checked, if the registered number of children is equal to the number of child items). If an inconsistency was found, a Tcl background error is raised.

-display boolean

If this option is switched on (together with the debugging option -enable), at varios places additional debugging output is printed to stdout.

-drawcolor color

When specified, areas of the window are painted with this color when drawing in those areas is about to occur. Setting this option has only an effect if the debugging options -enable and -display are switched on.

-enable boolean

All other debugging options only take effect if this option is also switched on.

-erasecolor color

When specified, areas of the window which have been marked as "invalid" (for example, when part of the window is exposed) are painted with this color. If you use an unusual color for this option (like pink), superflous screen redraws can be spotted more easily. Setting this option has only an effect if the debugging options -enable and -display are switched on.

-span boolean

Debugging related to column spanning.

-textlayout boolean

Debugging related to text-element layout.

pathName debug dinfo option

Returns a string describing display-related stuff. Option must be one of alloc, ditem, onscreen or range.

pathName debug expose x1 y1 x2 y2

Causes the area of the window bounded by the given window-coords to be marked as invalid. This simulates uncovering part of the window.

pathName depth ?itemDesc?

If the additional argument itemDesc is given, then the result is a decimal string giving the depth of the item described by itemDesc. If no itemDesc is specified, then the maximum depth of all items in the treectrl widget is returned instead. Depth is defined as the number of ancestors an item has.

pathName dragimage option ?arg ...?

This command is used to manipulate the drag image, which is used to provide feedback when items are drag-and-dropped within the window. The drag image is displayed as the dotted outlines of one or more items, columns and/or elements. The exact behavior of the command depends on the option argument that follows the dragimage argument. The following forms of the command are supported:

pathName dragimage add itemDesc ?column? ?element?

Adds the shapes of the item described by itemDesc to the shapes of the dragimage. Specifying additional arguments reduces the number of rectangles that are added to the dragimage. If no additional arguments is specified, for every element of the item in every column a dotted rectangles is added. If column is specified, all elements in other columns are ignored. If also element is specified, only a rectangle for this one element of the specified item in the given column is added.

pathName dragimage cget option

This command returns the current value of the dragimage option named option. Option may have any of the values accepted by the dragimage configure widget command.

pathName dragimage clear

Removes all shapes (if there are any) from the dragimage. This command does not modify the dragimage offset.

pathName dragimage configure ?option? ?value? ?option value ...?

This command is similar to the configure widget command except that it modifies the dragimage options instead of modifying options for the overall treectrl widget. If no option is specified, the command returns a list describing all of the available dragimage 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 dragimage 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 dragimage option(s) to have the given value(s); in this case the command returns an empty string.

The following dragimage options are supported:

-visible boolean

Specifies a boolean value which determines whether the dragimage should currently be visible.

pathName dragimage offset ?x y?

Returns a list containing the x and y offsets of the dragimage, if no additional arguments are specified. The dragimage offset is the screen distance the image is displayed at relative to the item(s) its shape is derived from. If two coordinates are specified, sets the dragimage offset to the given coordinates x and y.

pathName element option ?element? ?arg arg ...?

This command is used to manipulate elements (see ELEMENTS AND STYLES below). The exact behavior of the command depends on the option argument that follows the element argument. The following forms of the command are supported:

pathName element cget element option

This command returns the current value of the option named option associated with the element given by element. Option may have any of the values accepted by the element configure widget command.

This command also accepts the -statedomain option.

pathName element configure element ?option? ?value? ?option value ...?

This command is similar to the configure widget command except that it modifies options associated with the element given by element instead of modifying options for the overall treectrl widget. If no option is specified, the command returns a list describing all of the available options for element (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 option(s) to have the given value(s) in element; in this case the command returns an empty string. See ELEMENTS AND STYLES below for details on the options available for elements.

pathName element create name type ?option value ...?

Creates a new master element of type type with the unique user-defined name name and configures it with zero or more option/value pairs. See the subsections on individual element types in ELEMENTS AND STYLES for the options that are valid for each type of element. This command returns the name of the new element (the same as the name argument).

This command also accepts the -statedomain option with a value of either header or item to specify where this element will be displayed.

pathName element delete ?element ...?

Deletes each of the named elements and returns an empty string. If an element is deleted while it is still configured as an element of one or more styles by means of the style elements widget command, it is also removed from the element lists of these styles.

pathName element names

Returns a list containing the names of all existing elements.

pathName element perstate element option stateList

This command returns the value of the per-state option named option for element for a certain state. StateList is a list of state names (static and dynamic, see STATES) which specifies the state to use.

pathName element type element

Returns the type of the element given by element, such as rect or text.

pathName expand ?-recurse? ?itemDesc ...?

Deprecated. Use item expand instead.

pathName gradient option ?arg ...?

This command is used to manipulate color gradients. See GRADIENTS for more information about using gradients. The exact behavior of the command depends on the option argument that follows the gradient argument. The following forms of the command are supported:

pathName gradient cget gradient option

Returns the current value of the configuration option for the gradient specified by gradient whose name is option. Option may have any of the values accepted by the gradient configure command.

pathName gradient configure gradient ?option value ...?

If no option is specified, the command returns a list describing all of the available gradient 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 gradient 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 gradient option(s) to have the given value(s); in this case the command returns an empty string.

The following options are supported (see gradient create for the meaning of each option):

-bottom coordSpec
-left coordSpec
-orient direction
-right coordSpec
-steps stepCount
-stops stopsList
-top coordSpec
pathName gradient create name ?option value ...?

Creates a new gradient with the name name, which must be a unique name not used by another gradient created by this treectrl widget.

The following options are supported:

-bottom coordSpec
-left coordSpec
-right coordSpec
-top coordSpec

Each of these options specifies one edge of the gradient brush. If the option is specified as an empty string (the default), the gradient brush's edge is the same as that of whatever rectangle is being painted using the gradient. See GRADIENT COORDINATES for details on gradient brush coordinates.

The format of each of these options is a list of 2 or more values {value coordType ?arg ...?}, where value is a floating point number (usually from 0.0 to 1.0) and coordType is one of area, canvas, column or item. The area keyword must be followed by one of the same area names that the bbox command accepts. The column keyword may be followed by a column description specifying exactly one column. The item keyword may be followed by an item description specifying exactly one item.

-orient direction

This option specifies the direction a linear gradient changes color in. Must be either horizontal (the default) or vertical or an abbreviation of one of these.

-steps stepCount

Specifies the number of bands of color drawn for each color stop described by the -stops option. The default value is 1, the maximum is 25. This option has no effect if gradients are drawn using something better than Tk API calls. See GRADIENTS for more on this.

-stops stopsList

Specifies the color stops along this gradient. The argument stopsList has the following form:

{{offset color ?opacity?} {offset color ?opacity?} ...}

Each offset is a floating point number from 0.0 to 1.0 specifying the distance from the start of the gradient where the color begins. Each color is a Tk color name or description. Each optional opacity is a floating point number from 0.0 to 1.0 specifying how transparent the gradient is.

If stopsList is non-empty there must be at least two stops specified, and the first offset must be 0.0 and the last offset must be 1.0. Any other stop offsets must be listed in increasing order. Specifying opacity has no effect if gradients are drawn using Tk API calls. See GRADIENTS for more on this.

pathName gradient delete ?name ...?

Deletes each gradient specified by name. If the gradient is still being used then it is not actually deleted until all elements etc using the gradient have stopped using it. A deleted-but-in-use gradient is not recognized by the various gradient commands. Creating a new gradient with the same name as a deleted-but-in-use gradient resurrects the deleted gradient.

pathName gradient names

Returns a list of names of all the gradients that have been created by this treectrl widget.

pathName gradient native ?preference?

Without any arguments, this command returns a boolean indicating whether or not the platform supports native transparent gradients. The preference argument is a boolean that indicates whether native gradients should be used; this can be used to test the appearance of the application.

pathName header option ?arg ...?

This command is used to manipulate column headers. The exact behavior of the command depends on the option argument that follows the header argument. The following forms of the command are supported:

pathName header bbox headerDesc ?column? ?element?

See the item bbox command.

pathName header compare headerDesc1 op headerDesc2

See the item compare command.

pathName header configure headerDesc ?arg ...?

There are two forms of this command distinguished by whether or not a column description appears after the headerDesc argument. If the first argument after headerDesc begins with a '-' character it is assumed to be an option name, not a column description, in which case the command applies to the header-row. If the first argument after headerDesc does not being with a '-' it is assumed to be a column description, in which case the command applies to a header-column.

pathName header configure headerDesc ?option? ?value? ?option value ...?

If no option is specified, returns a list describing all of the available options for the header given by headerDesc (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 option(s) to have the given value(s); in this case the command returns an empty string. This is the only case where headerDesc may refer to multiple header-rows.

The following options are supported by this command (see header create for the meaning of each option):

-height height
-tags tagList
-visible boolean
pathName header configure headerDesc column ?option? ?value? ?option value ...?

If no option is specified, returns a list describing all of the available options for the single column column of the header-row given by headerDesc (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 option(s) to have the given value(s); in this case the command returns an empty string. This is the only case where both headerDesc may refer to multiple header-rows and column may refer to multiple header-columns.

The following options are supported by this command (see HEADERS) for the meaning of each option):

-arrow direction
-arrowbitmap bitmap
-arrowgravity direction
-arrowimage image
-arrowpadx amount
-arrowpady amount
-arrowside side
-background color
-bitmap bitmap
-borderwidth size
-button boolean
-font fontName
-image image
-imagepadx amount
-imagepady amount
-justify justification
-state state
-text text
-textcolor color
-textlines count
-textpadx amount
-textpady amount
pathName header count ?headerDesc?

If no additional arguments are given, the result is a decimal string giving the number of header-rows created by the header create widget command which haven't been deleted by the header delete widget command, plus 1 for the ever-present top header-row created along with the widget. If the optional argument headerDesc is given, then the result is the number of header-rows that match that header description.

pathName header create ?option value?

Creates a new header-row and returns its unique identifier. The following configuration options are supported:

-height height

Specifies a fixed height for the header-row in any of the forms acceptable to Tk_GetPixels. Must be >= 0. If height is zero then the header-row's height is the maximum height of all of its column headers. Defaults to 0.

-tags tagList

TagList is a list of tag names to be added to the new header-row. The header tag command can also be used to manipulate this list of tags.

-visible boolean

Boolean must have one of the forms accepted by Tcl_GetBoolean. It indicates whether or not the header-row should be displayed. If the widget option -showheader is false then the header-row will not be displayed regardless of the value of this option.

pathName header delete headerDesc

Deletes the header-rows given by the header description headerDesc. Attempts to delete the ever-present top header-row are ignored without raising an error.

pathName header dragcget ?arg ...?

There are two forms of this command distinguished by whether or not a header description appears as the first argument. If the first argument begins with a '-' character it is assumed to be an option name, not a header description, in which case the command applies to the header-drag-and-drop options for the widget. If the first argument does not being with a '-' it is assumed to be a header description, in which case the command applies to a header-row.

pathName header dragcget option

This command returns the current value of the header-drag-and-drop option named option for the widget. The following configuration options are supported (see header dragconfigure for the meaning of each option):

-enable boolean
-imagealpha alpha
-imagecolor background
-imagecolumn column
-imageoffset offset
-imagespan count
-indicatorcolor color
-indicatorcolumn column
-indicatorside side
-indicatorspan count
pathName header dragcget headerDesc option

This command returns the current value of the header-drag-and-drop option named option for a header-row. The following configuration options are supported (see header dragconfigure for the meaning of each option):

-draw boolean
-enable boolean
pathName header dragconfigure ?arg ...?

There are two forms of this command distinguished by whether or not a header description appears as the first argument. If the first argument begins with a '-' character it is assumed to be an option name, not a header description, in which case the command applies to the header-drag-and-drop options for the widget. If the first argument does not being with a '-' it is assumed to be a header description, in which case the command applies to a header-row.

pathName header dragconfigure ?option? ?value? ?option value ...?

This command queries and sets header-drag-and-drop options for the widget, not for individual header-rows. The following configuration options are supported:

-enable boolean

Controls whether the user is allowed to rearrange columns by drag-and-drop. The default is false. Each header-row also has an -enable dragconfigure option.

-imagealpha alpha

Alpha is an integer from 0 (invisible) to 255 (opaque) controlling the transparency of the drag image. Any value outside this range is clipped. The default is 200.

-imagecolor background

Unused.

-imagecolumn column

Column specifies the column to create the drag image from.

-imageoffset offset

Offset is the horizontal screen distance the drag image is offset from its starting position.

-imagespan count

Count is the number of columns, starting with -imagecolumn, that will be dragged as a group.

-indicatorcolor color

Unused.

-indicatorcolumn column

The 2-pixel-thick line will be drawn over the left or right edge of column.

-indicatorside side

Unused.

-indicatorspan count

Count is the number of columns, starting with -indicatorcolumn, that will be displaced as a group by the dragged column(s)

pathName header dragconfigure header ?option? ?value? ?option value ...?

This command queries and sets header-drag-and-drop options for header-rows, not for the widget as a whole. The following configuration options are supported:

-draw boolean

Controls whether a header-row displays any feedback during header drag-and-drop. The default is true.

-enable boolean

Controls whether clicking and dragging in this header-row initiates drag-and-drop. The default is true. If the -enable option for the widget is false (see above) then this option has no effect.

pathName header element ?arg ...?

See the item element command.

pathName header id headerDesc

This command resolves the header description headerDesc into a list of unique header-row identifiers. If headerDesc doesn't refer to any existing header-rows, then this command returns an empty list.

pathName header image headerDesc ?column? ?image? ?column image ...?

The behavior of this command depends on whether or not a column header was assigned a style containing an image element. If a column header has no style or no style with an image element then this command operates on the same -image option as header configure. Otherwise this command operates on the -image option of the first image element in a column header's style. See the item image command.

pathName header span headerDesc ?column? ?numColumns? ?column numColumns ...?

See the item span command.

pathName header state command headerDesc ?arg ...?

See the item state command.

pathName header style command headerDesc ?arg ...?

See the item style command.

pathName header text headerDesc ?column? ?text? ?column text ...?

The behavior of this command depends on whether or not a column header was assigned a style containing a text element. If a column header has no style or no style with a text element then this command operates on the same -text option as header configure. Otherwise this command operates on the -text option of the first text element in a column header's style. See item text.

pathName header tag command headerDesc ?arg ...?

See the item tag command.

pathName identify ?-array varName? x y

This command returns information about the what is displayed at the given window coordinates x and y. When the -array option is used to specify the name of an array variable, elements of the array variable are set as follows:

  1. If the coordinates are outside the window, over the borders, or over any whitespace in the window, then:

    $varName(where) is ""

  2. If the coordinates are over a column header, then:

    $varName(where) is header

    $varName(header) is the unique id of the header-row

    $varName(column) is the unique id of the column

    $varName(element) is the name of an element, or ""

    $varName(side) is left or right if the coordinates are close to the edge of the column header, otherwise ""

  3. If the coordinates are over an item, then:

    $varName(where) is item

    $varName(item) is the unique id of the item

    $varName(column) is the unique id of the column

    $varName(element) is the name of an element, or ""

    $varName(button) is a boolean indicating whether or not the coordinates are over the item's expand/collapse button

    $varName(line) is the unique id of an ancestor of the item (but not the parent of the item) if the coordinates are over a line descending from that ancestor. If the coordinates are not over such a line then $varName(line) is "". This is used to collapse the ancestor when the line is clicked on.

When the -array option is not used, this command returns a list describing what is displayed at the given window coordinates. The format of this list can be like one of the following:

  1. {}

    An empty list is returned if the coordinates are outside the window, over the borders, or over any whitespace in the window.

  2. header C ?left|right?

    header C elem E ?left|right?

    header H column C ?left|right?

    header H column C elem E ?left|right?

    Only when there is more than one header-row is there a unique id of a header-row H followed by the keyword column. This is for compatibility with older versions when there was only one row of column headers allowed.

  3. item I column C

  4. item I column C elem E

  5. item I button

    This is the result when the coordinates are over the expand/collapse button next to an item.

  6. item I line I2

    This is the result when the coordinates are over a line descending from an ancestor I2 of the item I (but not the parent of that item). This is used to collapse the ancestor when the line is clicked on.

pathName index itemDesc

Deprecated. Use item id instead.

pathName item option ?arg ...?

This command is used to manipulate items. The exact behavior of the command depends on the option argument that follows the item argument. The following forms of the command are supported:

pathName item ancestors itemDesc

Returns a list containing the item ids of the ancestors of the item specified by itemDesc. The first list value is the parent, the second is the parent's parent, an so on. The last list value will be the root item if itemDesc is a descendant of the root item.

pathName item bbox itemDesc ?column? ?element?

Returns a list with four elements giving the bounding box of the item described by itemDesc. If no further argument is specified, the bbox spans the area of the item over all non-locked columns. If a column is specified, only the area of the item in this column is considered. If an additional element is specified, the area of this element in column of the specified item is returned. The returned coordinates are relative to the top-left corner of the widget. If the item is not visible for any reason, the result in an empty string.

pathName item buttonstate itemDesc ?state?

If state is specified, this command sets the state of the expand/collapse button for the single item specified by itemDesc. The state argument may be one of active, normal or pressed. The current (or newly-set) state of the button is returned. The button state is used by the system theme, if any, to change the appearance of the button.

pathName item cget itemDesc option

Returns the current value of the configuration option for the item specified by itemDesc whose name is option. Option may have any of the values accepted by the item configure command.

pathName item children itemDesc

Returns a list containing the item ids of all children of the item specified by itemDesc in the correct order from the first child to the last child.

pathName item collapse itemDesc ?-animate? ?-recurse?

Switches off the open state of the item(s) described by itemDesc. If an item has descendants, then they are no longer displayed. If an item is already closed, then this command has no effect on that item. If -animate is specified, then the item's button will animate as it transitions between states if the theme supports it; in this case only one item may be specified. If -recurse is specified, then all descendants of the items described by itemDesc will also be collapsed. For every item that actually will be collapsed, two events are generated: a <Collapse-before> event before the item state is changed, and a <Collapse-after> event after the item state was changed.

pathName item compare itemDesc1 op itemDesc2

From both items described by the itemDescs the index is retrieved (as returned from the item order widget command). Then these indexes are compared using the operator op, which must be either <, <=, ==, >=, >, or !=. The return value of this command is 1 if the comparison evaluated to true, 0 otherwise.

pathName item complex itemDesc ?list...?

This horrible command is now deprecated. Use item element configure instead. For every column of the treectrl there may be specified one list. Each list should look like this:

{ {element option value ...} {element option value ...} ...}

Every option must be known by the element's type (see ELEMENTS AND STYLES below). Each option will be set to value for the element in this one column in this item.

pathName item configure itemDesc ?option? ?value? ?option value ...?

If no option is specified, returns a list describing all of the available options for the item given by itemDesc (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 item option(s) to have the given value(s); in this case the command returns an empty string. This is the only case where itemDesc may refer to multiple items.

The following options are supported by this command (see item create for the meaning of each option):

-button boolean|auto
-height height
-tags tagList
-visible boolean
-wrap boolean
pathName item count ?itemDesc?

If no additional arguments are given, the result is a decimal string giving the number of items created by the item create widget command which haven't been deleted by the item delete widget command, plus 1 for the ever-present root item. If the optional argument itemDesc is given, then the result is the number of items that match that item description.

pathName item create ?option value ...?

Creates some new items and optionally returns a list of unique identifiers for those items. The new items have the states open and enabled set by default. If the treectrl widget currently has the focus, the state focus is also set.

The following options are supported by this command:

-button boolean|auto

The value of this option must have one of the forms accepted by Tcl_GetBoolean or be the word auto (or any abbreviation of it). It indicates whether or not an expand/collapse button should be drawn next to the item, typically to indicate that the item has children. If the value of this option is auto, then a button is displayed next to the item whenever the item has any children whose item option -visible is true. The button will only be displayed if:

  1. the column specified by the treectrl option -treecolumn is visible, and

  2. the treectrl option -showbuttons is true, and

  3. for the root item, the treectrl option -showrootbutton is true, and

  4. for immediate children of the root item, the treectrl option -showrootchildbuttons is true.

-count numItems

Specifies the number of items to create. Must be >= 0. Defaults to 1.

-enabled boolean

Specifies whether the items should be enabled. Default is true.

-height height

Specifies a fixed height in any of the forms acceptable to Tk_GetPixels. Must be >= 0. If height is zero then the item's height is unspecified. Defaults to 0. See also the widget options -itemheight and -minitemheight.

-nextsibling itemDesc

Specifies the item before which the new items will be inserted. The new items will have the same parent as itemDesc.

-open boolean

Specifies whether the items should be open or closed. Default is true.

-parent itemDesc

Specifies the item which the new items will be the children of. The new items will be appended to the list of children of itemDesc. When no parent is specified, the new items are orphan items (see the widget command orphans) and will not be displayed in the list.

-prevsibling itemDesc

Specifies the item after which the new items will be inserted. The new items will have the same parent as itemDesc.

-returnid boolean

Specifies whether or not to return a list of item identifiers for the newly created items. Specifying false is useful when creating a large number of items in the console or to improve performance. Default is true.

-tags tagList

TagList is a list of tag names to be added to the new items. The item tag command can also be used to manipulate this list of tags.

-visible boolean

Boolean must have one of the forms accepted by Tcl_GetBoolean. It indicates that the item should be displayed in the list. The item will only be displayed if:

  1. each ancestor is a descendant of the root item (not an orphan), and

  2. each ancestor's -visible option is true

-wrap boolean

Boolean must have one of the forms accepted by Tcl_GetBoolean. It indicates that this item should be the first one in a horizontal range or vertical range of items. See also the widget option -wrap.

pathName item delete first ?last?

Deletes the specified item(s). First and last must be valid item descriptions. If last isn't specified, then first may specify multiple items. If both first and last are specified, they must each decribe a single item with a common ancestor; then the range of items between first and last is deleted. The order of first and last doesn't matter.

Deleting an item deletes any child items of the deleted item recursively. If the current active item is deleted, the root item becomes the new active item. If the current selection anchor item is deleted, the root item becomes the new anchor item. There is no way to delete the root item of the treectrl widget; in all cases the specification of the root item is ignored.

For each call to this command, two events may be generated. If any of the deleted items are selected, then they are removed from the selection and a <Selection> event is generated just before the items are deleted. If any items are going to be deleted, then an <ItemDelete> event is generated just before the items are deleted.

pathName item descendants itemDesc

Returns a list containing the item ids of the descendants of the item specified by itemDesc, i.e. the children, grandchildren, great-grandchildren etc, of the item.

pathName item dump itemDesc

Debug command. Returns a list with 4 words in the form index index indexVis indexVis.

pathName item element command itemDesc column element ?arg ...?

This command is used to manipulate elements of the item. The exact behavior of the command depends on the command argument that follows the element argument. The following forms of the command are supported:

pathName item element actual itemDesc column element option

Deprecated. Use item element perstate instead.

pathName item element cget itemDesc column element option

This command returns the value of the option named option associated with element inside column of the item described by itemDesc, if it was already configured for the actual item. Option may have any of the values accepted by the type of the specified element (see ELEMENTS AND STYLES below)

pathName item element configure itemDesc column element ?option? ?value? ?option value ...?

This command modifies configuration options for an element in a column of an item. If no option is specified, the command returns a list describing all of the available options for the element (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 option(s) to have the given value(s) in the element inside column of the item(s) described by itemDesc; in this case the command returns an empty string. This is the only case where itemDesc may refer to multiple items.

It is possible to configure multiple elements in multiple columns with a single call. To configure another element in the same column, append a '+' argument followed by the element name. To configure elements in another column, append a ',' argument followed by the column. For example:

.t item element configure $I \
	$C1 $E1 -text "hello" + $E2 -text "world" , \
	$C2 $E3 -fill Blue , \
	$C3 $E1 -text "apples and oranges"

Each of the column description arguments to this command may refer to multiple columns if at least one option-value pair is given.

pathName item element perstate itemDesc column element option ?stateList?

This command returns the current value of the per-state option named option for element inside column of the item described by itemDesc. If stateList is specified, the list of state names (static and dynamic, see STATES) is used in place of the current state for item and column.

pathName item enabled itemDesc ?boolean?

Returns 1 if the item described by itemDesc has the state enabled switched on, 0 otherwise. If boolean is specified, then the enabled state of every item described by the item description itemDesc is set accordingly. New items are enabled by default when created. Disabled items cannot be selected, and are ignored by the default key-navigation and mouse bindings.

pathName item expand itemDesc ?-animate? ?-recurse?

Switches on the open state of the item(s) described by itemDesc. If an item has descendants, then they are now displayed. If an item is already open, then this command has no effect on that item. If -animate is specified, then the item's button will animate as it transitions between states if the theme supports it; in this case only one item may be specified. If -recurse is specified, then all descendants of the items described by itemDesc will also be expanded. For every item that actually will be expanded, two events are generated: an <Expand-before> event before the item state is changed, and an <Expand-after> event after the item state was changed.

pathName item firstchild parent ?child?

If child is not specified, returns the item id of the first child of the item described by parent. If child is specified, it must describe an item that is neither the root item nor an ancestor of parent. Then it will become the new first child of parent.

pathName item id itemDesc

This command resolves the item description itemDesc into a list of unique item identifiers. If itemDesc doesn't refer to any existing items, then this command returns an empty list.

pathName item image itemDesc ?column? ?image? ?column image ...?

This command sets or retrieves the value of the per-state -image option for the first image element in one or more columns. If no column is specified, this command returns a list of values, one per column. If no image is specified, this command returns the value for column.

If one or more column-image pairs is specified, then the value of the -image option in each column is set to image. In this case itemDesc may refer to multiple items and each column may refer to multiple columns.

Note that this command is provided as a convenience. Use the item element configure or item element cget commands if you want to set or retrieve the value of the -image option for a specific image element.

pathName item isancestor itemDesc descendant

Returns 1 if the item described by itemDesc is a direct or indirect parent of the item decribed by descendant, 0 otherwise.

pathName item isopen itemDesc

Returns 1 if the item described by itemDesc has the state open switched on, 0 otherwise.

pathName item lastchild parent ?child?

If child is not specified, returns the item id of the last child of the item described by parent. If child is specified, it must describe an item that is not an ancestor of parent. Then it will become the new last child of parent.

pathName item nextsibling sibling ?next?

If next is not specified, returns the item id of the next sibling of the item described by sibling. If next is specified, it must describe an item that is not an ancestor of sibling. Then it will become the new next sibling of sibling.

pathName item numchildren itemDesc

Returns the number of children of the item described by itemDesc.

pathName item order itemDesc ?-visible?

This command returns the position of the item itemDesc relative to its toplevel ancestor (usually the root item, unless the ancestor is an orphan). If you imagine all the items flattened into a vertical list, the result of this command is the row the item falls in. If the optional argument -visible is given, only the items whose ancestors are expanded, and whose -visible option is true, get counted; in this case -1 is returned if the item is not visible.

pathName item parent itemDesc

Returns the item id of the parent of the item described by itemDesc.

pathName item prevsibling sibling ?prev?

If prev is not specified, returns the item id of the previous sibling of the item described by sibling. If prev is specified, it must describe an item that is not an ancestor of sibling. Then it will become the new previous sibling of sibling.

pathName item range first last

Returns a list containing the item ids of all items in the range between first and last, inclusive. The order between first and last doesn't matter, and the result is always sorted by the increasing order of the items (as returned by the item order command). The items specified by first and last must share a common ancestor.

pathName item remove itemDesc

Removes the item described by itemDesc from the list of children of its parent, so that it will become an orphan.

pathName item rnc itemDesc

Returns a list of two integers, which corresponds to the row and column of the item described by itemDesc. The row and column corresponds to the on-screen arrangement of items as determined by the -orient and -wrap options. If the item is not displayed, this command returns an empty string.

pathName item sort itemDesc ?option ...?

Sorts the children of the item described by itemDesc, and redisplays the tree with the items in the new order.

The range of items which should be sorted can be restricted by means of the -first and/or -last options, which should be children of the item described by itemDesc; the order between these two limiting items doesn't matter.

The sort column can be specified by means of the -column option; this option can be used repeatedly to define a multicolumn sort. The sorting is done by looking at the text of the element specified by the -element option, which must be a text element defined in the style of the sorting column, by default the first text element is used.

If the -notreally option is specified, no rearranging of the items is done; instead the sorted items are returned as result of the command.

By default ASCII sorting is used with the result returned in increasing order. Any of the following options may be specified to control the sorting process of the previously specified column (unique abbreviations are accepted):

-ascii

Use string comparison with ASCII collation order. This is the default.

-command command

Use command as a comparison command. To compare two items, evaluate a Tcl script consisting of command with the numerical ids of the two items appended as additional arguments. The script should return an integer less than, equal to, or greater than zero if the first item is to be considered less than, equal to, or greater than the second, respectively.

-decreasing

Sort the items in decreasing order ("largest" items first).

-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, in -dictionary mode, bigBoy sorts between bigbang and bigboy, and x10y sorts between x9y and x11y.

-increasing

Sort the items in increasing order ("smallest" items first). This is the default.

-integer

Convert to integers and use integer comparison.

-real

Convert to floating-point values and use floating comparison.

pathName item span itemDesc ?