| Ticket UUID: | 2148529 | |||
| Title: | Canvas scrolls when scrollbar indicates that it cannot. | |||
| Type: | Bug | Version: | 8.5.4, 8.6.18, 9.0.5, 9.1b1 | |
| Submitter: | alsterg | Created on: | 2008-10-05 23:50:19 | |
| Subsystem: | 16. [scrollbar] | Assigned To: | jan.nijtmans | |
| Priority: | 7 High | Severity: | Minor | |
| Status: | Closed | Last Modified: | 2026-09-30 16:05:42 | |
| Resolution: | Fixed | Closed By: | jan.nijtmans | |
| Closed on: | 2026-09-30 15:19:42 | |||
| Description: |
Description: In a canvas widget, when the scrollregion is smaller than the allocated window space (width/height), then a scrollbar attached to it that (as it should) indicates that the canvas cannot be scrolled, can still be used to scroll it if the user attempts it anyway (e.g. by clicking the right scrollbar button in the following example). This is primarily a usability inconsistency. Proof-of-concept: grid [tk::canvas .c -width 200 -height 200 -scrollregion "0 0 50 50" -xscrollcommand ".h set"] grid [tk::scrollbar .h -orient horizontal -command ".c xview"] -column 0 -row 1 -sticky we .c create rectangle 0 0 30 30 -tags rect Version Information: Tcl Version 8.5.1 Tk Version 8.5.4 X Window System Version 7.2.0 X Protocol Version 11, Revision 0, Release 7.2 OS: OpenSuse 10.3 % array get tcl_platform osVersion 2.6.22.18-0.2-default pointerSize 8 byteOrder littleEndian threaded 1 machine x86_64 platform unix os Linux user alex wordSize 8 Contact Information: [email protected] | |||
| User Comments: |
serhiy.storchaka added on 2026-09-30 16:05:42:
My mistake: [1f958e6c4d] contains only the fix for [1954237]; its message was copied from [3a1b43c46d] and wrongly mentions this ticket. The fix for this ticket ([6f39abf1a1], in CanvasSetOrigin()) was never backported to 8.6, so canvas-25.1 fails there. Backported now in [a197754344] together with the test; canvas-25.1 fails without it and passes with it. jan.nijtmans added on 2026-09-30 15:19:42: Question @serhiy.storchaka. In [1f958e6c4d022837|this] commit, the backport of this ticket to 8.6 was done, but the corresponding testcase (now: canvas-25.1) was not backported. I wonder what was the reason. Trying this testcase, I get (Windows 11):
==== canvas-25.1 a canvas is not scrolled if its scroll region fits in it - bug 2148529 FAILED
==== Contents of test case:
set res {}
foreach cmd {{xview scroll -1 units} {xview scroll -5 pages}
{xview moveto -0.5} {yview scroll -1 units} {yview moveto -0.5}} {
.c {*}$cmd
update
lappend res [.c canvasx 0] [.c canvasy 0]
}
lsort -unique $res
---- Result was:
-150.0 -20.0 -24.0 0.0
---- Result should have been (exact matching):
0.0
==== canvas-25.1 FAILED
With Tk 9.0 and 9.1 this testcase passes. Any idea why this testcase still fails in Tk 8.6? serhiy.storchaka added on 2026-09-25 10:58:28: Backported to 8.6 in [1f958e6c4d]. jan.nijtmans added on 2026-09-25 10:31:42: Fixed [2535a940feb929dd|here] and in core-9-0-branch Feel free to backport this to 8.6, if you want. serhiy.storchaka added on 2026-09-22 12:45:17: Still reproducible with 8.6.18, 9.0.5 and 9.1, and not only with the scrollbar: with a canvas of 200x200 and -scrollregion {0 0 50 50}, "xview scroll -1 units" moves the origin to -20, "xview scroll -5 pages" to -150, "xview moveto -0.5" to -24, and clicking the left arrow of the scrollbar to -20, while xview keeps reporting "0.0 1.0". Scrolling to the right is refused. The classic and the ttk scrollbar behave the same way, since both only call "xview". The cause is in CanvasSetOrigin(): with -confine true the correction handles only the cases where one side of the scroll region lies outside the visible area; when the region fits entirely in the window, nothing is corrected. Fixed in [6f39abf1a1] (branch canvas-confine-small-region): in that case the origin is kept at the top left corner of the scroll region. Test canvas-32.1. hobbs added on 2009-05-09 03:59:08: It also occurs to the ttk::scrollbar, although it appears to be disabled. You can still scroll to the left. dkf added on 2008-10-06 15:23:04: It looks to me like a bug in the Unix scrollbar implementation (it's not there in the OSX native scrollbars either, but it's easy to duplicate with an X11 build on OSX). ferrieux added on 2008-10-06 13:26:33: Not reproducible on Windows with current ActiveTcl (8.5.4). I assume this is due to Windows having a native scrollbar where disabled state is serious about it, while X11 implementation has more (buggy) degrees of freedom... | |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki