Updated 2015-08-10 10:18:42 by dkf
BWidget::Tree pathName ?option value…?

This is a tree widget that uses a canvas internally to display a hierarchical list of items (called nodes).

Manual page edit

http://tcllib.sourceforge.net/BWman/Tree.html

Examples edit


 Selection Improvements

TR - The Tree has no default binding for the selection of ranges. This is usually done by selectiong a node and then selecting another while pressing down the Shift key. This proc will do the work:
proc TreeSelectRange {tree node} {
        #
        # add a continuous range of nodes to an existing selection
        #
        # tree -> path to the BWidget tree
        # node -> the node that has been clicked on
        #
        
        # remember current selection:
        set sel [$tree selection get]
        # get last selected node:
        set last [lindex $sel end]
        # select the requested range:
        $tree selection range $last $node
        # add the remembered nodes:
        foreach node $sel {$tree selection add $node}
}

Then you just need something like
$tree bindText <Shift-Button-1> [list TreeSelectRange %W]

to make the binding work.