TkTree js Object

TkTree js Object


  • interp
  • path_name
  • widget_obj

A container for holding information for a BWidget Tree widget. That one was rather hard, as in the end it is implemented as an own table for every node in the tree. That is necessary as otherwise you do not easily get all the columns of the tree rendered with the same size.

I have got inspiration from a treeview implementation from GubuSoft and from YUI treeview. The tick is to use little images for the opentree, closetree and for the lines between the nodes and the image for the node. The last field in the table does not handle overflow, so that the text labels can be as long as they are needed.

There is an event handler attached to the opentree and closetree images and another one to the node image and the node text, these can also be different using the Tk bindImage and bindText options.

The opentree and closetree event handlers just set the first level sub nodes style of the selected node to {display: none}, which makes that subtree invisible after rendering (it needs no space any more and looks like the nodes have been removed). When opening the tree again one just has to set the sub nodes style to {display: block} or {display: table-row} and the subtree is visible again.

(Part of Tk Widgets in Javascript Paper)