Version 11 of treeview

Updated 2007-07-06 10:04:39 by UKo

This is the treeview widget of the Tile widget set. The treeview widget is intended to provide something that's a little more powerful (and faster) than the BWidge::Tree widget, and a little bit simpler to use (though less powerful) than the TkTreeCtrl widget.


The screenshot below shows the treeview as part of a larger program (using the clam theme). There is a header and 6 entries (where two are one level down).

http://tcl.typoscriptics.de/misc/tile-treeview.png


The basics of this widget are:

 package require tile
 tile::setTheme clam
 # create it:
 ttk::treeview .tree
 pack .tree -expand 1 -fill both
 # insert an entry at the root level:
 set entry1 [.tree insert {} end -text "first item"]
 # and a second one:
 set entry2 [.tree insert {} end -text "second item"]
 # insert a new level with entry1 as parent:
 .tree insert $entry1 end -text "a sublevel"
 # insert another item under this one:
 .tree insert $entry1 end -text "another item"
 # suppose, one item is selected.
 # we can then delete it thus:
 .tree delete [.tree selection]

BAS

 # Also, to add the heading:
 .tree heading #0 -text Features
 # I also like the heading a little closer to the frame
 .tree configure -padding {0 0 0 0}

Sarnold uses a BWidget Tree in which some data is associated with each entry. ttk::treeview does not seem - to my great surprise - to handle other data than the text. Is it true ? Is adding such a feature planned ?


Category Example | Category Widget