Description: |
If for a ScrollableFrame both -constrainedwidth and -constrainedheight are set to true, the scrollable area is shrinked to its minimum size instead of being expanded to take all available space. As soon as the widget gets a "resize" event, the size of the area gets adjusted to what you'd expect.
The following code snipped illustates the issue best (meant to be copied into a console step by step):
# "Setup" - the label and backgroud color are merely to visualize the issue
package require BWidget
ScrollableFrame .sf
grid .sf
.sf.frame configure -bg blue
label .sf.frame.l -text "Hello"
grid .sf
grid .sf.frame.l
# The problem...
.sf configure -constrainedwidth 1
# Everything's fine so far
.sf configure -constrainedheight 1
# At this point the frame is shrunk th its original size!
# resize the toplevel window at this point: the frame will change to the desired size
The following patch should fix the issue:
diff -u bwidget-1.9.7-orig/scrollframe.tcl bwidget-1.9.7/scrollframe.tcl
--- bwidget-1.9.7-orig/scrollframe.tcl 2013-12-08 17:23:21.810759369 +0100
+++ bwidget-1.9.7/scrollframe.tcl 2013-12-08 17:34:28.310445852 +0100
@@ -116,20 +116,20 @@
set modcw [Widget::hasChanged $path -constrainedwidth cw]
set modw [Widget::hasChanged $path -areawidth w]
if { $modcw || (!$cw && $modw) } {
- if { $cw } {
- set w [winfo width $path]
- }
set upd 1
}
+ if { $cw } {
+ set w [winfo width $path]
+ }
set modch [Widget::hasChanged $path -constrainedheight ch]
set modh [Widget::hasChanged $path -areaheight h]
if { $modch || (!$ch && $modh) } {
- if { $ch } {
- set h [winfo height $path]
- }
set upd 1
}
+ if { $ch } {
+ set h [winfo height $path]
+ }
if { $upd } {
$path:cmd itemconfigure win -width $w -height $h
|