Tk Library Source Code

View Ticket
Login
Ticket UUID: 1046955
Title: BWidget 1.7.0: Tree::insert does not find parent node
Type: Patch Version: None
Submitter: rogerjmeier Created on: 2004-10-14 10:59:18
Subsystem: bwidget Assigned To: hobbs
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2007-11-01 01:54:41
Resolution: Fixed Closed By: hobbs
    Closed on: 2007-10-31 18:54:41
Description:
To the maintainer of BWidget's Tree widget:

When inserting an element into a parent tree node which
contained an ampersand (&) in the node name, this
parent node is not found and an error is issued by
Tree::insert.

The following code shows the behaviour:

package require BWidget 1.7
frame .ftop
pack .ftop
set sampleTree .ftop.tsample
Tree $sampleTree
pack $sampleTree
$sampleTree insert end root "/First&IT" -text "First&IT"
$sampleTree insert end "/First&IT" "Abc" -text "Abc"

The error is:

node "/First&IT" does not exist
    while executing
"Tree::insert .ftop.tsample end /First&IT Abc -text Abc"
    ("eval" body line 1)
    invoked from within
"eval [linsert $args 0 Tree::$cmd .ftop.tsample]"
    (procedure ".ftop.tsample" line 1)
    invoked from within
"$sampleTree insert end "/First&IT" "Abc" -text "Abc""
    (file
"/home/users/roger/Dev/TclTk/Singles/treetest.tcl" line 17)

When removing the "&" character from the insert
commands it works.

The attached one-line patch solves the problem: The
parent node name is not converted to canonical form
with _node_name before checking if the array entry exists.

The patch does the following:

set parent [_node_name $path $parent]

This call overwrites parent with the canonical (mapped
special characters) node name, add this line just
before the [info exists data($parent)] line.

The patch worked fine for me. I did not check the rest
of the tree.tcl for other missing _node_name calls --
maybe there are more...

-- Roger

PS: Thanks for the cool Tree widget!
User Comments: hobbs added on 2007-11-01 01:54:41:
Logged In: YES 
user_id=72656
Originator: NO

applied.

rogerjmeier added on 2004-10-14 17:59:19:

File Added - 105065: bwidget-1.7.0-tree.diff

Attachments: