BWidget problem again, I discovered that when you
use a NoteBook and insert a page where a
ScrolledWindow/ScrollableFrame couple is created,
then when the size of the NoteBook is computed with
$nb compute_size (see below) then the
size is not correctly computed and some widgets are
masked. In the example below (cut and paste to test it)
the second button is masked :
package require BWidget
set top [toplevel .top]
set nb [NoteBook $top.nb]
set f1 [$nb insert 1 page1 -text "Page 1"]
set sw [ScrolledWindow $f1.sw]
set sff [ScrollableFrame $f1.sw.f -areawidth 0 -constrainedwidth true]
$sw setwidget $sff
set base [$sff getframe]
button $base.b1 -width 50 -text button1
button $base.b2 -width 50 -text button2
pack $base.b1 $base.b2 -side left
pack $sw
pack $nb
$nb compute_size
$nb raise page1
Is there a workaround or is it a bug ? Thanks for help.
S.
Nobody cares ? Are BWidget widgets supposed to be compatible
with each other ?
S.
I can only say, that I had often trouble with the ScrolledWindow
widget.
I also encountered a similar problem in 2001.
Since this moment, I personnaly don't use the ScrolledWindow widget
(even if I liked the see command).
Here is some code I use to display config pages in a tabbed notebook
with scrolable pages. You can still see my tries 6 years ago.
Nevertheless I like BWidgets very much.
J'éspère que ca aide,
Harald
---
set PNote [NoteBook $Base.n]
pack $PNote -side top -fill both -expand true
set Index 0
foreach Module $state(ModulesLoaded) {
set PNoteFrame [$PNote insert $Index $Module -text \
[namespace eval ::$Module {mc configLabelstitle}]]
# > the ScrolledWindow did not resize on the total y size but the
"see"
# > command was good to display an errorneous widget.
#set PScroll [ScrolledWindow $PNoteFrame.s -scrollbar vertical\
-relief sunken -borderwidth 2]
#pack $PScroll -side top -fill both -expand true
#set PScrollFrame [ScrollableFrame $PScroll.f -constrainedwidth true
\
-height 200]
#$PScroll setwidget $PScrollFrame
#set PFrameScrolled [$PScrollFrame getframe]
set PScrollbar [scrollbar $PNoteFrame.s -orient vertical]
pack $PScrollbar -side right -fill y
set PCanvas [canvas $PNoteFrame.c -yscrollcommand "$PScrollbar set"]
pack $PCanvas -side left -fill y
$PScrollbar configure -command "$PCanvas yview"
set PFrameScrolled [frame $PCanvas.f]
$PCanvas create window 0 0 -anchor nw -window $PFrameScrolled
bind $PFrameScrolled <Configure> [namespace code\
"ScrolledFormResize $PNote $PCanvas $PFrameScrolled"]
ConfigPageCreate $Module config $PFrameScrolled PropEntry\
${Module}ConfigGet
set ConfigPaths($Module) $PFrameScrolled
incr Index
}
$PNote compute_size
$PNote raise main
$PNote see main
Your answer gave me the good idea, this is just a timing
problem, here is the fix : after packing the the buttons
I insert
update idletasks
and then I change the width of the scrollableFrame
to its required width
$sff configure -width [winfo reqwidth $base]
then everything is OK (modified code below).
S.
package require BWidget
set top [toplevel .top]
set nb [NoteBook $top.nb]
set f1 [$nb insert 1 page1 -text "Page 1"]
set sw [ScrolledWindow $f1.sw]
set sff [ScrollableFrame $f1.sw.f -areawidth 0 -constrainedwidth true]
$sw setwidget $sff
set base [$sff getframe]
button $base.b1 -width 50 -text button1
button $base.b2 -width 50 -text button2
pack $base.b1 $base.b2 -side left
update idletasks
$sff configure -width [winfo reqwidth $base]