Tk Source Code

View Ticket
Login
2026-05-22
17:43 • Closed ticket [082a30e4]: Error in ::tk::ScrollByUnits plus 7 other changes artifact: 153e168d user: nemethi
17:20
Fix for ticket [082a30e45a]: Error in ::tk::ScrollByUnits. check-in: 2eb7e410 user: csaba tags: core-9-0-branch
17:11
Fix for ticket [082a30e45a]: Error in ::tk::ScrollByUnits. check-in: cca7d076 user: csaba tags: trunk, main
2026-05-21
15:57 • Ticket [082a30e4] Error in ::tk::ScrollByUnits status still Open with 5 other changes artifact: ab1e8d35 user: nemethi
10:18 • New ticket [082a30e4]. artifact: e6a9bcec user: SVIDevelopment

Ticket UUID: 082a30e45a101c8c7776af1075a6bd2813e13709
Title: Error in ::tk::ScrollByUnits
Type: Bug Version: 9.0.2
Submitter: SVIDevelopment Created on: 2026-05-21 10:18:35
Subsystem: 16. [scrollbar] Assigned To: nemethi
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2026-05-22 17:43:20
Resolution: Fixed Closed By: nemethi
    Closed on: 2026-05-22 17:43:20
Description:
We received a bug report about an error in ::tk::ScrollByUnits:

can't read "Priv(xEvents)": no such element in array
    while executing
"if {($Priv(xEvents) + $Priv(yEvents) > 10) &&
		($axis eq "x" && $Priv(xEvents) < $Priv(yEvents) ||
		 $axis eq "y" && $Priv(yEvents) < $Priv(xEvents)..."
    (procedure "tk::ScrollByUnits" line 14)

We have not been able to reproduce it ourselves, but looking at the logic it seems like the <Enter> events was not (yet) resolved when ::tk::ScrollByUnits was entered. So a valid fix seems to be to make sure both "events" variables are initialized before doing the if statement, by adding

set otherAxis [expr {$axis eq "x" ? "y" : "x"}]
if {![info exists Priv(${otherAxis}Events)]} {
    set Priv(${otherAxis}Events) 0
}

The platform is Windows.
User Comments: nemethi (claiming to be Csaba Nemethi) added on 2026-05-22 17:43:20:

Fixed by commits [cca7d076] (main) and [2eb7e410] (core-9-0-branch). In addition, guarded against potential similar problems related to entry and notebook widgets.


nemethi (claiming to be Csaba Nemethi) added on 2026-05-21 15:57:02:

Assigned to myself. The fix is coming soon.