BLT treeview question: Why am i getting a Runtime Error when... 
Author Message
 BLT treeview question: Why am i getting a Runtime Error when...

I'm running BLT 2.4w for Tcl/Tk 8.3 on Windows NT.
In the following script, why do I get a Runtime Error?
The error appears to occur when the hide by tag name is issued after a
node has been deleted.

package require BLT

blt::treeview .t
pack .t

# insert some nodes in the root
# and give each one a tag
.t insert 0 test
.t tag add file 1

.t insert 0 test2
.t tag add file 2

.t insert 0 test3
.t tag add file 3

.t insert 0 test4
.t tag add file 4

# delete any node with delete or entry delete
.t delete 4

# try to issue the hide command by tag name
.t hide file



Mon, 30 Aug 2004 01:05:09 GMT  
 BLT treeview question: Why am i getting a Runtime Error when...

Quote:

> I'm running BLT 2.4w for Tcl/Tk 8.3 on Windows NT.  In the following
> script, why do I get a Runtime Error?  The error appears to occur
> when the hide by tag name is issued after a node has been deleted.

This is a bug in the treeview widget. This bug is also in 2.4x.  When
you delete a node, the node should be removed from the tag table. It
isn't.  This will be fixed in the next release.

As a workaround, you could explicitly discard the tag when you delete
the node.

    .t tag delete file 4
    .t delete 4

But this works so long as there aren't descendant nodes also tagged.

Here's the real workaround.  The "treeview" widget uses a tree data
object to hold the data.  You can create a tree data object using the
"tree" command and pass that to the "treeview" widget.  You can use
the "tree" command to insert and tag items and the "treeview" widget
to display them, all working from the same tree.

The "tree" command does the right thing when it deletes a node.  It
will remove the node from any tag table that it may be in.

    package require BLT

    # Create a tree data object
    set tree [blt::tree create]

    # Pass it to the treeview widget via the -tree option.
    blt::treeview .t -tree $tree
    pack .t

    # Insert some nodes in the root and give each one a tag.
    $tree insert 0 -label test -tags file
    $tree insert 0 -label test2 -tags file
    $tree insert 0 -label test3 -tags file
    $tree insert 0 -label test4 -tags file

    # Delete any node with the "tree" command's delete
    # operation. (Note this "delete" gets rid of the
    # tag information automatically.)
    $tree delete 4

    # Try to issue the hide command by tag name.  (Note that we're
    # using the treeview widget again to "hide" the tagged nodes.)
    .t hide file

--gah



Mon, 30 Aug 2004 07:34:53 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Why am I getting bind errors?

2. ERROR 48 - Why am I getting it?

3. why am i getting processor stack fault error?

4. BLT treeview's -shadow option: Fatal error when -shadow {}

5. BLT - TreeView Question

6. Why am I getting a NaN?

7. Newbe help : Why am I getting this output ?!?

8. BLT treeview question: Why do I get an Application Error When..

9. I am getting THISTHREADACTIVE error (lots of them)

10. A fatal error i am getting in CosmoWorlds.

11. BLT gets this far and gives this error

12. blt treeview issue

 

 
Powered by phpBB® Forum Software