Tk Library Source Code

View Ticket
Login
Ticket UUID: 2783019
Title: scrollwindow bug - flickering scrollbar
Type: Bug Version: None
Submitter: nobody Created on: 2009-04-28 17:26:21
Subsystem: bwidget Assigned To: damonc
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2009-06-29 20:06:44
Resolution: Fixed Closed By: oehhar
    Closed on: 2009-06-29 13:06:44
Description:
The attached example shows a problem with scrolledwindow in bwidget. The scrolledwindow gets into an infinite loop between xscroll and yscroll when we zoom in out on this example.

Tcl/tk version : 8.5.3
BWidget version : 1.8


package require Tcldot
package require BWidget

set graphstring {digraph graph5 {
        node [label="\N"];
        graph [bb="0,0,370,250"];
        "x" [label="AAA\n.Dl", fontsize=12, fontname=zzzfont, style=filled, fillcolor=white, shape=diamond, pos="150,214", width="2.69", height="1.00"];
        z [label=Hs, fontsize=12, fontname=zzzfont, style=filled, fillcolor=white, shape=rectangle, pos="53,64", width="1.47", height="0.50"];
        "y" [label="dl", fontsize=12, fontname=zzzfont, style=filled, fillcolor=white, shape=diamond, pos="247,64", width="3.42", height="1.78"];
        "x" -> z [fontsize=12, fontname=zzzfont, color=black, arrowsize="0.7", label=hs, pos="e,65,82 131,185 113,156 86,115 69,88", lp="152,153"];
        "x" -> "y" [fontsize=12, fontname=zzzfont, color=black, arrowsize="0.7", label=hs, pos="e,220,115 173,186 179,178 187,169 193,160 201,148 209,134 216,121", lp="236,153"];
}}

set g [dotstring $graphstring]

toplevel .t
set sw [ScrolledWindow .t.sw]
set cvs [canvas .t.sw.cvs]
$sw setwidget $cvs
pack $sw -side top -fill both -expand yes
bind $cvs <Button-4>  "zoom $cvs 1.1"
bind $cvs <Button-5>  "zoom $cvs 0.9"
eval [$g render $cvs dot]
$cvs configure -scrollregion [$cvs bbox all]

proc zoom {cvs factor} {
  $cvs scale all 0 0 $factor $factor
  $cvs configure -scrollregion [$cvs bbox all]
}
User Comments: oehhar added on 2009-06-29 20:06:43:
Private E-Mail resulted in the test script:

set sw [ScrolledWindow .sw]
set cvs [canvas .sw.cvs]
$sw setwidget $cvs
pack $sw -side top -fill both -expand yes
bind $cvs <Button-1> "zoom $cvs 1.1"
bind $cvs <Button-2> "zoom $cvs 0.9"
$cvs create rect 0 0 416 283 -fill red
$cvs configure -scrollregion [$cvs bbox all]

proc zoom {cvs factor} {
$cvs scale all 0 0 $factor $factor
$cvs configure -scrollregion [$cvs bbox all]
}

I got the endless loop when I press zoom, zoom, unzoom, zoom on Linux, not Windows.
The issue arised, because the window size was changed when the scrollbars were mapped.

The issue is solved by a more severe locking.

Please report, if this works or if it raises other issues.

oehhar added on 2009-06-25 22:30:16:
Put to pending state. It works for me. Please inform if there is still an issue. Note that the used ScrolledWindow got improved in cvs.

oehhar added on 2009-06-02 22:58:02:
Thank you for the bug report.

I have simplified your demo script using a canvas showing only one box (and not the dot graph) and checked it using windows and linux.

Unfortunately, there was no unexpected behaviour when zooming in or out (bind buttons or maximize function).

Chould you please:
- verify, if the attached script shows the issue for you (eventually change the size of the box)
- Post your platform and display details (resolution, main window size)

Best regards,
Harald

-Example script-
lappend auto_path .
package require BWidget

set sw [ScrolledWindow .sw]
set cvs [canvas .sw.cvs]
$sw setwidget $cvs
pack $sw -side top -fill both -expand yes
bind $cvs <Button-1> "zoom $cvs 1.1"
bind $cvs <Button-2> "zoom $cvs 0.9"
$cvs create rect 0 0 500 500 -fill red
$cvs configure -scrollregion [$cvs bbox all]

proc zoom {cvs factor} {
$cvs scale all 0 0 $factor $factor
$cvs configure -scrollregion [$cvs bbox all]
}
-EOF-