| Description: |
Following is a test code, run it and your will see a
ScrolledWindow shaking. Before you run it, please make
sure that "CP: 555 * AAA-I am shaking wildly 10mm dia:
59.5 mm" is in a single line. The length of the list
item name really matters.
######### test code starts ######################
set bwidget_path *YOUR BWIDGET PATH HERE*
lappend auto_path $bwidget_path
package require BWidget
toplevel .shaking
set f [frame .shaking.butF]
set sw [ScrolledWindow $f.sw -auto both\
-relief sunken -borderwidth 2]
set marksList [ListBox $f.lb -relief flat -borderwidth 0 \
-padx 0 -height 8 -width 40 -bg white]
$sw setwidget $marksList
grid $sw -row 0 -column 0 -columnspan 6 -pady 0 -padx 2m
$marksList insert end 1 -text "1"
$marksList insert end 2 -text "2"
$marksList insert end 3 -text "3"
$marksList insert end 4 -text "CP: 555 * AAA-I am
shaking wildly 10mm dia: 59.5 mm"
# make sure that "CP: 555 * AAA-I am shaking wildly
10mm dia: 59.5 mm" is a single line
$marksList insert end 5 -text "5"
$marksList insert end 6 -text "6"
$marksList insert end 7 -text "7"
$marksList insert end 8 -text "8"
pack $f
#### test code ends #################################
#### test environment ################################
If you run it by wish8.3, no problme at all,
if you run it by wish8.4, you got a shaking widget.
My testing environment:
1. Redhat Linux 2.4.21-9.ELsmp
2. BWidget-1.7.0, tcl 8.4, and tk 8.4
3. Default font
#### Code analysis ##################################
Bwidget induces an endless loop through a "bind" command.
(In Bwidget-1.7.0),
In line 105 of listbox.tcl:
bind ListBox <Configure> [list ListBox::_resize %W]
In proc ListBox::_resize, line 1139 of listbox.tcl:
it call _update_scrollregion :
} else {
if {[Widget::cget $path -selectfill]} {
_update_select_fill $path
}
_update_scrollregion $path
}
in proc ListBox::_update_scrollregion, line 918 of
listbox.tcl
it call $path.c configure -scrollregion [list 0 0 $w $h]
This triggered bind ListBox <Configure> event and call
_resize again, forming a loop.
If you put in "puts " command in _resize and
_update_scrollregion
you will see _resize and _update_scrollregion called
alternatively
Reason:
Bwidget induces a endless loop by "bind" command.
(In Bwidget-1.7.0),
In line 105:
bind ListBox <Configure> [list ListBox::_resize %W]
In proc ListBox::_resize, line 1139 of listbox.tcl:
it call _update_scrollregion
in proc ListBox::_update_scrollregion, line 918 of
listbox.tcl
it call $path.c configure -scrollregion [list 0 0 $w $h]
This triggered bind ListBox <Configure> event and call
_resize again, forming a loop.
|