Tk Library Source Code

Artifact [1da576f0b6]
Login

Artifact 1da576f0b64c75177ea2d235c32e5f84b1d4acfd:

Attachment "bwidgetListBoxBug.tk" to ticket [1752755fff] added by legolas_a20 2007-07-12 23:36:50.

#attempt to reproduce the error described here:
# http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/97c4892c68312e6b?hl=en

package require BWidget

#create a ListBox in a ScrolledWindow
#Note: without -selectfill true, there is no error!

ScrolledWindow .sw
ListBox .sw.lb -selectfill true
.sw setwidget .sw.lb

button .b -command {testBug} -text "Show Bug!"

#drop the button and listbox on a grid, make the column resizable
grid .sw -column 0 -row 0 -sticky we
grid .b  -column 1 -row 0 -sticky we

#without this, there is no error:
grid columnconfigure . 0 -weight 1

#for some reason, it does not happen at the default size.
wm minsize . 500 100


#Note: attempting to insert an item named "a:" causes a
#'parent namespace does not exist' error during insert.
#Same with anything that inclusdes "::" in the name.

.sw.lb insert end "a1" -text "a"
.sw.lb selection set {a1}


proc testBug { } {
    #remove selected item
    .sw.lb delete [.sw.lb selection get]
    #now cause a resize of the listbox by enlarging the button text
    .b configure -text "[.b cget -text]aaaa"
}