Tk Library Source Code

View Ticket
Login
Ticket UUID: 621178
Title: BWidget error in Tree under 8.4
Type: Bug Version: None
Submitter: damonc Created on: 2002-10-10 08:00:22
Subsystem: bwidget Assigned To: jenglish
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2003-01-25 05:22:58
Resolution: Fixed Closed By: jenglish
    Closed on: 2003-01-24 22:22:58
Description:
The following code under ActiveTcl 8.4.0.1 under Windows:

package require BWidget

pack [Tree .t]

.t insert end root foo -text Foo
.t selection set foo
.t delete foo


Yields the result:

.t selection set: Cannot select unknown node "foo".
    while executing
"selection .t set foo"
    ("eval" body line 1)
    invoked from within
"eval selection $path set $sel"
    (procedure "Tree::delete" line 18)
    invoked from within
"Tree::delete .t foo"
    ("eval" body line 1)
    invoked from within
"eval Tree::$cmd .t $args"
    (procedure ".t" line 1)
    invoked from within
".t delete foo "

This only occurs if the deleted node is selected.  If
you remove the "selection set" line, everything works fine.
User Comments: jenglish added on 2003-01-25 05:22:58:
Logged In: YES 
user_id=68433

Committed patch (tree.tcl r1.38)

jenglish added on 2003-01-17 07:24:36:

File Added - 39831: bwidget-tree-delete-selected.patch

jenglish added on 2003-01-17 07:24:35:
Logged In: YES 
user_id=68433

Attached patch should fix the problem.  
Fix: remove deleted nodes from the selection in
Tree::_subdelete instead of Tree::delete.

jenglish added on 2003-01-17 06:54:08:
Logged In: YES 
user_id=68433

Looks like this problem was introduced in revision 1.36
(related to Bug #547245?); "selection set" and other
commands that modified the selection formerly ignored
nonexistent nodes, now they raise an error.  But [delete]
(perhaps inadvertently) relied on the old behaviour.

jenglish added on 2003-01-17 06:29:04:
Logged In: YES 
user_id=68433

Reopening; patch 621331 didn't fully fix the problem.  
Deleting an ancestor of a selected node still fails:

package require BWidget 
pack [Tree .t]
.t insert end root foo -text Foo
.t insert end foo bar -text bar
.t selection set bar
.t delete foo

==> ".t selection set: Cannot select unknown node "bar"."

hobbs added on 2002-10-15 03:45:26:
Logged In: YES 
user_id=72656

fixed by patch 621331

Attachments: