What: TkTreeCtrl Where: http://sourceforge.net/projects/tktreectrl/ Description: multi-column hierarchical listbox widget for Tk. It is a stubs-enabled extension (written in C). Builds and works on Win98, Peanut-Linux 9.4, and appears to work on SPARC Solaris 2.6. (According to a posting on comp.lang.tcl it also works on MacOS Classic and MacOS X). Documentation is now available in the CVS repository. Currently at version 2.2.3 Updated: 11/2006 Contact: See web site ---- Screenshots and homepage: http://tktreectrl.sourceforge.net/ ---- You can download win32 binaries, and there is a nice '''demo and docs included'''. The easiest way to obtain a working copy of treectrl for many platforms is to simply use the binaries in [ActiveTcl]. Doesn't only do tree widgets, it can also do fancy image thumbnail tables - see the demo. ---- [MATS] (2 march 2005) In cvs there is now support for tiled background images similar to what can be found in my Coccinella tree widget http://hem.fyristorg.com/matben/. It seems that you need to use the BG_IMAGE when building to use this feature. Then just specify your image as -backgroundimage. [http://www.visit.se/~matben/wiki/treectrlbgimage.png] ---- [MAK] (19 Jan 2005) If you use TkTreeCtrl, you'd be well advised to be very scrupulous of your code that uses it whenever you upgrade to a new version. There has been a tendency on more than one occasion for incompatible changes being made without any notice or mention in the ChangeLog, and sometimes without a version number change. ---- ''How about someone adding a screenshot'' [MPJ] ~ Ok ... Here is one from the demo script that comes with TkTreeCtrl. [http://mywebpages.comcast.net/jakeforce/tktreectrl.jpg] ---- [TR] - Since there is no tutorial on the usage of this widget, I had to fiddle around with it for quite a time in order to learn its use. Here is a quick intro: (There is now a tutorial style intro here: http://tktreectrl.sourceforge.net/Understanding%20TkTreeCtrl.html) '''Components of a treectrl''' The widget consists of at least one ''column'' (for table-like output). Each entry in the widget is called an ''item'' and reaches over all columns. The items are composed by adding some ''elements'' together to ''styles''. The styles are applied to the items and then it shows up in the widget. In other words (taken from the manual page largely): * ''element:'' The smallest building block. One or more elements together can be combined to a style, which can be considered as a template for an item. These are the possible element types: bitmap, border, image, rect, and text. * ''item:'' A set of elements. The look of the items is desribed by styles. * ''styles:'' Could be considered as a geometry manager for the elements of one item. '''A short example''' Now let us use this knowledge to create a little example. We first create the widget after having started wish: package require treectrl treectrl .t pack .t Now we configure it to have one column. Note: elements, styles, and items are created using the ''create'' subcommand while columns are created by using the subcommand ''configure'' on a new index (here 0). Our column will get a label called "Items" and the column should use the whole width of the widget by default. TGGB (20/05/2005): Actually, don't you have to create the column first using [[''pathName'' column create]], as I've inserted below? .t column create .t column configure 0 -text Items -expand yes -button no Before we can add our first item, we need to specify what elements the item should have (we just make a text element here called ''e1'') and what style it should have (called ''s1'' here): .t element create el1 text .t style create s1 # apply style s1 to element el1: .t style elements s1 el1 Now, we are ready to add the first item: # create a new item: set itm [.t item create] # apply the style from above to the first (and only) column of the item: .t item style set $itm 0 s1 # give the item a label: .t item text $itm 0 "Hello World" # and display it as the las child of the root node: .t item lastchild root $itm This is it. An item saying ''Hello World'' should appear. ---- IMA 2004-11-22: Does anybody know how to edit items in place in TkTreeCtrl? Thanks [Peter Newman] 23 November 2004: 1) See the Explorer demos (they have filename editing). Or; 2) Use `item bbox' to find out where the item to be edited is, and `place' your entry or whatever widget there. IMA 2004-11-24: Hi Peter, the explorer demo in tktreectrl 1.1.0 I downloaded does not allow to edit anything (running on Linux RH 8.0) I've found the following code: set ::TreeCtrl::Priv(edit,$T) {e2} set ::TreeCtrl::Priv(sensitive,$T) { {name styName e1 e2} } set ::TreeCtrl::Priv(dragimage,$T) { {name styName e1 e2} } $T notify bind $T { %T item text %I 0 %t } Is this supposed to allow editing? Thanks [Peter Newman] 25 November 2004: 1) The filename editing works under Windows 95/98/XP. I don't see why it shouldn't work under Linux (though I suppose you could argue that a perfect emulation of Windows Explorer shouldn't work on Linux). 2) To invoke the editing; put the mouse cursor on the filename to be edited. then click once; wait about 1 second; then click again. 3) Yes, the code above seems to be part of the editing support. And there's a whole lot more code in `filelist-bindings.tcl'. 4) As far as I can see, that code uses the `item bbox' technique I suggested above. But it seems way more complex that you need. Don't see why it needs more than 10 lines (though I suppose the `treectrl' version's complexity is because they're trying to emulate Explorer exactly). IMA 2004-11-25: Thanks Peter! It works indeed. It's just so annoyingly slow... I guess I was too impatient to wait that second:) Thanks again for great support:) ---- TJM 2005-10-03 How dependent is TkTreeCtrl on Tk 8.4? Will it work with Tk 8.0.5? [JH] While you could backport it to Tk 8.4, it would require some work. You would have to remove the use of class procs and any references to UTF-based APIs. The question is, why still bother with 8.0.5? [escargo] Everyone does not have the freedom to update the available platform; for example, if vendor ''X'' delivers their product with Tcl8/Tk8 (and doesn't provide a build environment), you might not be able to use newer code. TJM 2005-10-04 Thanks for the confirmation JH. It's a matter of at least a week's worth of work for me, making sure all of the other libraries my project depends on work with 8.4. 'Spose I'll have to do at some point anyway. ---- [[ [Category Package] | [Category GUI] | [Category Widget] ]]