Tree Widget for TK Version 3.4 ------------------------------ Introduction ------------ This Directory contains the sources for a Tk-3.4 based widget for displaying dynamic trees. The tree widget is implemented in C++ and has been tested on Sun4/OS4.1.3 and HP-UX using gcc-2.5.2 and libg++-2.5.2. On a Sun, older versions of gcc (eg: 2.3.3) also work fine (see HP note below). Features of the Tree Widget --------------------------- With the tree widget, you can display a tree in a Tk canvas. The nodes can be made up of any number of canvas items or even other Tk widgets. You create the objects that make up a node and the line that connects it to its parent and pass them to the tree widget. After this the tree widget manages the positions of the nodes and end points of the tree lines. Operations are available for inserting, moving and removing nodes and subtrees and for querrying the position of a node in the tree. The tree can be displayed horizontally or vertically. Documentation ------------- There is a manual page in the man directory that describes the tree widget in detail for those wishing to use it in tk scripts. Requirements ------------ The following software is required to compile this release: from ftp.cs.berkeley.edu:/ucb/tcl: tk-3.4 or later tcl-7.1 or later (well actually, tk-3.3 and tcl-7.0 should work as well) Compiling --------- 1. run ./configure from the top level directory. Configure creates the file master.mk, which is included by all the source makefiles. 2. Type make Type make from the top level directory. This compiles the class library libOS.a and the tree widget library and creates an executable named "treesh" that is a modified version of the Tk "wish" shell. ::Note HP: On HP-UX, I ran into compiler bugs with gcc-2.4.5 and had to upgrade to gcc-2.5.2/libg++-2.5.2 with the GNU gas assembler. ::Note C++ main: If you use g++/gcc, you can use the standard Tk library main and just define your own commands in tkAppInit.c. However, other C++ compilers require the main routine to be compiled for C++. In this case, you can make a dummy C++ main, rename the TK main routine to tkmain and call it from the C++ main: extern "C" tkmain(int argc, char** argv); main(int argc, char** argv) { return tkmain(argc, argv); } Demos ------ In the demos directory are 3 demos. To try them out, cd to the demos directory and run one of these scripts: - simple - just demonstrates the tree widget by creating a static tree - dirtree1 - allows you to navigate through the directory tree by double clicking on node labels or bitmaps. - dirtree2 - a more complicated version of dirtree1. Clicking with mouse B2 on a directory opens up a file list in the tree. -- Please send bug fixes, comments etc. to me... Allan Brighton allan@piano.sta.sub.org (home) allan@multinet.de (work)