Tk Source Code

View Ticket
Login
Ticket UUID: fe5549bad807af82b28905b86c37b744a879415
Title: Error in ::tk::spinbox::ButtonUp on MacOS
Type: Bug Version: 9.0.2
Submitter: SVIDevelopment Created on: 2025-12-11 09:44:22
Subsystem: 17. [spinbox] Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2025-12-16 12:20:00
Resolution: Fixed Closed By: nemethi
    Closed on: 2025-12-16 12:20:00
Description:
On MacOS, we sometimes get the following error when clicking on a spinbox:

unknown option "-entryrelief"
    while executing
"$w configure -$Priv(element)relief $Priv(relief)"
    (procedure "::tk::spinbox::ButtonUp" line 12)

The current code for ::tk::spinbox::ButtonUp is

proc ::tk::spinbox::ButtonUp {w x y} {
    variable ::tk::Priv

    ::tk::CancelRepeat

    # Priv(relief) may not exist if the ButtonUp is not paired with
    # a preceding ButtonDown
    if {[info exists Priv(element)] && [info exists Priv(relief)] && \
	    [string match "button*" $Priv(element)]} {
	if {[info exists Priv(repeated)] && !$Priv(repeated)} {
	    $w invoke $Priv(element)
	}

        $w configure -$Priv(element)relief $Priv(relief)
	$w selection element none
    }
}

Probably, the bug occurs when $Priv(element) is a button element before the call to $w invoke $Priv(element), but is then changed to entry as a side effect. It can probably be fixed by checking [string match "button*" $Priv(element)] again before doing the configure.
User Comments: nemethi (claiming to be Csaba Nemethi) added on 2025-12-16 12:20:00:

Fixed in all three branches, see commits [d9a0ab33], [f7262b17], and [98c19932].


SVIDevelopment added on 2025-12-15 08:47:00:
Yes the spinbox does have a command associated with it, which does quite a lot of work (it's very likely "update" is called at some point).

nemethi (claiming to be Csaba Nemethi) added on 2025-12-13 20:25:22:

What is the value of the -command option?  If it is a nonempty string then the line

	    $w invoke $Priv(element)

triggers an invocation of that Tcl command, and the latter might set (probably inadvertently) Priv(element) to "entry".