Tk Library Source Code

View Ticket
Login
Ticket UUID: 2807227
Title: ScrollableFrame issues
Type: Patch Version: None
Submitter: danckaert Created on: 2009-06-16 15:30:03
Subsystem: bwidget Assigned To: hobbs
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2009-06-29 19:18:17
Resolution: Accepted Closed By: oehhar
    Closed on: 2009-06-24 11:35:45
Description:
There are some problems with ScrollableFrame. The following code demonstrates them:

pack [panedwindow .pw -orient vertical] -fill both -expand 1
.pw add [set f [frame .pw.f -relief sunken -bd 1]] -minsize 30
.pw add [set d [frame .pw.d -relief sunken -bd 1]] -minsize 30

grid\
    [ScrollableFrame $f.sf -height 300 -yscrollcommand [list $f.yscroll set]]\
    [scrollbar $f.yscroll -orient vertical -command [list $f.sf yview]]\
    -sticky news
grid rowconfigure $f 0 -weight 1
grid columnconfigure $f 0 -weight 1

set g [$f.sf getframe]

update

pack\
    [button $g.a -text A -command [list destroy $g.a]]\
    [button $g.b -text B -command [list destroy $g.a $g.b]]\
    [button $g.c -text C -command [list destroy $g.a $g.b $g.c]]\
    [button $g.d -text D -command [list destroy $g.a $g.b $g.c $g.d]]\
    [button $g.e -text E -command [list destroy $g.a $g.b $g.c $g.d $g.e]]\
    [button $g.f -text F -command [list destroy $g.a $g.b $g.c $g.d $g.e $g.f]]

Now resize the panes of the panedwindow with the mouse (just a little bit). You will see that the scrollbar becomes active even though there is no reason (yet) for it.

A second issue can be triggered by resizing the upper pane until just 2 or 3 of the buttons are still visible. Next, move the scrollbar down such that the last buttons (E and F) are visible. Now click the E button. You will see that the ScrollableFrame misbehaves.

The attached patch solves these issues.
User Comments: oehhar added on 2009-06-29 19:18:17:
Hi Koen,
thank you, corrected (after light tests).
Please stay as critic as possible - also formatting, documentation etc.

Thank you,
Harald

danckaert added on 2009-06-25 22:24:58:
Hi Harald,
I think the new CVS version is not completely right. But it's partly my fault: I wasn't aware that some of my earlier changes were already in CVS (submitted by Jos Decoster), so my patch was w.r.t. the 1.8 release instead of CVS head.
Could you do the following:
- Remove the <Configure> binding on $canvas. For this event, _frameConfigure is called from _resize. (Since $canvas is a user visible widget, you should not impose bindings on it.)
- Remove the <Expose> binding. Its usage is discouraged in the Tk bind manual. I have replaced it with the bindings on <Map> and <Unmap>.

Another note: I noticed that you use Windows-style linebreaks in the code (^M^L). Maybe it's better not to do that?

Regards,
Koen

oehhar added on 2009-06-24 18:35:44:
Hello Koen,
thank you for the demonstration script and the patch.
For me, it works very well and solves issues I have open since years.

I have slightly modified the patch to keep as much lines unmodified as possible.
In addition, the formatting is adapted to the environment.

Could you please verify, if the current cvs works for you ?
Does the entry in the changelog hit the point ?

Regards,
Harald

oehhar added on 2009-06-16 22:46:50:
Sorry, will go for a business trip for one week.
Will look on it next week.

Thank you,
Harald

danckaert added on 2009-06-16 22:30:04:

File Added - 331199: scrollf.patch

Attachments: