A view that displays a hierarchy of items. It is divided into rows and column: each row represents an item, and each column represents a different data field of the items.
The items are represented in code by instances of TreeViewItem, returned by the various TreeView methods. Top level items are added via the TreeView interface, while child items are added via the TreeViewItem interface, which also allows to manipulate items in more detail after their creation.
Items can be visually sorted with -sort, or by clicking on one of the column headers, if -canSort is enabled.
Each item can hold other views in each of its data fields, which allows for rich graphical interaction. See TreeViewItem: -setView.
Gets or sets the number of columns (data fields) and their names. When setting a smaller number of columns than the current the extra columns will be removed, and hence all the data stored stored in those columns.
labels |
An array of Strings for column names. |
The total number of columns (data fields).
Append a new top-level item.
strings |
An array of Strings (or nil), each for the text of one data field. |
An instance of TreeViewItem representing the new item.
Insert a new top-level item at index
.
index |
The position at which to insert the item. |
strings |
An array of Strings (or nil), each for the text of one data field. |
An instance of TreeViewItem representing the new item.
Remove the given item
. After the item is removed, any usage of the related TreeViewItems will have no effect.
item |
An instance of TreeViewItem. |
The total number of items.
Removes all items.
Gets or sets the currently selected item.
item |
An instance of TreeViewItem. |
An instance of TreeViewItem or nil, if no current item.
The item at index
.
Alias for -itemAt, provided for compatibility with TreeViewItem.
Alias for -addItem, provided for compatibility with TreeViewItem.
Alias for -addChild, provided for compatibility with TreeViewItem.
Sort items by data in column
. This works regardless of -canSort.
column |
The integer column index to sort by. |
descending |
Whether to sort in descending or ascending fashion. The default is ascending. |
column |
The integer index of a column |
Integer width of column in pixels. If column
is not in the range 0..(numColumns-1)
, returns -1
.
Sets the width of a column. The rightmost column must extend at least to the right bound of the TreeView.
column |
The integer index of the column to modify |
width |
Integer width in pixels |
Whether the user can sort the items by clicking on a column header.
When setting to true
, the items will be sorted immediately according to the current sorting column. While true
, the view will also automatically sort new items.
The default is false
.
See also: -sort.
The object to be evaluated when a mouse button is pressed on an item, passing this view as the argument.
The object to be evaluated whenever the current item changes, passing this view as the argument.