|
|
(3 intermediate revisions by one other user not shown) |
Line 1: |
Line 1: |
− | == Background ==
| + | <big>'''Note:''' We are migrating this content to the slicer.org domain - <font color="orange">The newer page is [https://www.slicer.org/wiki/Slicer3:GUI_Experiments:TkTreeCtrl here]</font></big>a |
− | | |
− | [http://tktreectrl.sourceforge.net/ TkTreeCtrl] is a pretty amazing set of interface functionality for displaying trees where each row can be a multi-column list and/or a set of interface widgets. The interface is highly configurable (as shown in the demos) and very efficient. It is a cross-platform tcl extension.
| |
− | | |
− | As of late June 2007, TkTreeCtrl is built as part of KWWidgets and is exposed for use in Slicer3. Note that it does not yet have a C++ API so any use of TkTreeCtrl must be implemented in tcl (this code can be invoked from C++ using the Script() method on a KWWidget).
| |
− | | |
− | == Running the Demo in Slicer3 ==
| |
− | | |
− | First, download and unpack the package from [http://tktreectrl.sourceforge.net/ TkTreeCtrl]. Version 2.2.3 or later should work.
| |
− | | |
− | In Slicer3:
| |
− | * open the tcl console (Control-T or use the menu)
| |
− | * cd to the directory where you unpacked TkTreeCtrl
| |
− | * cd to the demos directory
| |
− | * type the following commands
| |
− | proc console {args} {}
| |
− | source demo.tcl
| |
− | wm deiconify .
| |
− | * experiment and have fun!
| |
− | ** note that the File menu includes options for viewing the source of each demo (note how brief and elegant each demo is!)
| |
− | ** you can even watch the events as you interact with the tree demos
| |
− | ** you can edit the configuration parameters of the trees on the fly and see the visual result
| |
− | | |
− | == Plans == | |
− | | |
− | * Test the widget
| |
− | ** Example MRML tree (Steve) (see the ColorTree example described below)
| |
− | ** Model Hierarchy display properties (Alex)
| |
− | ** EMSegment (Brad)
| |
− | ** QueryAtlas (Wendy)
| |
− | * Propose useful C++ API (all) for implementation by Sebastien and Yumin
| |
− | | |
− | == Links ==
| |
− | | |
− | * [http://wiki.tcl.tk/6064 tcl wiki entry on tktreectrl]
| |
− | * [http://tktreectrl.sourceforge.net/Understanding%20TkTreeCtrl.html a tutorial]
| |
− | * [http://tktreectrl.sourceforge.net home page]
| |
− | | |
− | Note there is an HTML manpage with the source distribution that you can load into a browser to use as a reference.
| |
− | | |
− | == Example ==
| |
− | | |
− | The simple example below is taken from [http://wiki.tcl.tk/6064] and can be pasted directly into the slicer3 tcl console:
| |
− | | |
− | catch "destroy .t"
| |
− | toplevel .t
| |
− | package require treectrl
| |
− | treectrl .t.t
| |
− | pack .t.t
| |
− | .t.t column create
| |
− | .t.t column configure 0 -text Items -expand yes -button no
| |
− | .t.t element create el1 text
| |
− | .t.t style create s1
| |
− | .t.t style elements s1 el1
| |
− | set itm [.t.t item create]
| |
− | .t.t item style set $itm 0 s1
| |
− | .t.t item text $itm 0 "Hello World"
| |
− | .t.t item lastchild root $itm
| |
− | | |
− | A more sophisticated example has been checked into the slicer3 svn (see [http://www.na-mic.org/ViewVC/index.cgi/trunk/Base/GUI/Tcl/ColorTree.tcl?view=log]). To try this, open the tcl interactor and type:
| |
− | source $::env(SLICER_HOME)/../Slicer3/Base/GUI/Tcl/ColorTree.tcl
| |
− | ::ColorTree::ShowDialog
| |