|
2026-09-27
| ||
| 19:41 | • Closed ticket [2358545f]: spinbox formatting has side effect plus 8 other changes artifact: 6a86a9f0 user: jan.nijtmans | |
|
2026-09-24
| ||
| 09:57 | Fix [2358545fff] (again). Thanks, Serhiy! check-in: 8ebff84d user: jan.nijtmans tags: core-8-6-branch | |
| 08:22 | • Pending ticket [2358545f]: spinbox formatting has side effect plus 4 other changes artifact: cd928ff7 user: serhiy.storchaka | |
| 08:19 | • Ticket [9e89324a] spinbox parses its value with sscanf("%lf"), which depends on the LC_NUMERIC locale status still Open with 3 other changes artifact: 1926ae19 user: serhiy.storchaka | |
|
2011-06-08
| ||
| 04:17 | • Ticket [2358545f] spinbox formatting has side effect status still Open with 5 other changes artifact: dce576b9 user: dgp | |
| 04:07 | • Ticket [2358545f]: 4 changes artifact: 843ca1cc user: dgp | |
|
2010-05-10
| ||
| 21:32 | • Ticket [2358545f]: 4 changes artifact: 99d84465 user: dgp | |
| 21:29 | • Ticket [2358545f]: 1 change artifact: b33585b0 user: dgp | |
| 21:29 | • Ticket [2358545f]: 4 changes artifact: 4244b00c user: dgp | |
|
2010-05-09
| ||
| 05:34 | • Ticket [2358545f]: 6 changes artifact: d200c569 user: jenglish | |
| 02:01 | • Ticket [2358545f]: 4 changes artifact: b27311a9 user: teopetuk | |
| 01:13 | • Ticket [2358545f]: 6 changes artifact: 44b1490d user: dgp | |
|
2010-05-08
| ||
| 12:04 | • Ticket [2358545f]: 4 changes artifact: 788f4dd8 user: teopetuk | |
|
2008-11-29
| ||
| 10:40 | • New ticket [2358545f]. artifact: ad78dddc user: jack_r | |
| Ticket UUID: | 2358545 | |||
| Title: | spinbox formatting has side effect | |||
| Type: | Bug | Version: | obsolete: 8.5.8 | |
| Submitter: | jack_r | Created on: | 2008-11-29 10:40:03 | |
| Subsystem: | 17. [spinbox] | Assigned To: | aku | |
| Priority: | 5 Medium | Severity: | Minor | |
| Status: | Closed | Last Modified: | 2026-09-27 19:41:51 | |
| Resolution: | Fixed | Closed By: | jan.nijtmans | |
| Closed on: | 2026-09-27 19:41:51 | |||
| Description: |
If a spinbox is formatted with -format %02.0f, when we decrease with arrow we pass from 09 to 00 and when increasing with arrow, it is never possible to go above 09 if we start below 09. If already above 10 and increasing, it works. Below sample code works with Tk 8.4.19 but failed with Tk 8.5 (ActiveTcl 8.5.5, Debian Lenny 8.5.3, eTcl 8.5.2 or 8.5.5) package require Tk set versions "" lappend versions "Tcl: $tcl_patchLevel" lappend versions "Tk : $tk_patchLevel" label .l -text [join $versions \n] pack .l set second 15 spinbox .sb -from 0 -to 59 \ -format %02.0f -width 2 -textvariable second pack .sb | |||
| User Comments: |
jan.nijtmans added on 2026-09-27 19:41:51:
Fixed (again) [8ebff84d765ca1b3|here] serhiy.storchaka added on 2026-09-24 08:22:25:
The same octal problem came back on core-8-6-branch with the fix for [9e89324a0a], which replaced dgp added on 2011-06-08 04:17:04: Fix merged to trunk. Leaving open at reduced prio so we can consider creating the Tcl_* routines to better support this sort of thing. Either public access to TclParseNumber() or some Tcl_Scan*() sort of thing along the lines of Tcl_Format*(). dgp added on 2011-06-08 04:07:04: Fixed for Tk 8.5.10 replacing Tcl_GetDouble() calls with sscanf( "%lf"). dgp added on 2010-05-10 21:32:53: now that I see the comment that ttk::spinbox does not have this failure, I wonder how many of these redesign ideas are already in place in that? dgp added on 2010-05-10 21:29:03: jenglish beat me to it. Trouble is that the spinbox widget takes pains to conceptually treat the value as a double while actually storing it as a string, with full sprintf() - Tcl_GetDouble() round trip on every change. The implicit assumption is that every -format choice produces a string that can be re-parsed again as a double. The unified number parser in Tcl 8.5 does not do that since it consistently treats "08" as not a double as well as not an integer. After that the remaining behavior is explained by the spinbox behavior that any attempt to set to a value that is not a double will cause reset to the -from value. The long term solution for this particular example is Kill Octal. The question raised is whether there are any other -format values that lead to the same problem where the generated string is no longer a valid Tcl double. If so, then I think the design of spinbox needs reconsideration, which might be a good idea anyway. The effort taken to force storage of a double in string form is certainly not what I expected. For a more limited focus on just fixing the bug, perhaps a call to TclParseNumber() ought to be used rather than Tcl_GetDouble(). Then the flag TCL_PARSE_DECIMAL_ONLY could be employed to control the parsing. It appears to me that only decimal is used for spinbox values. Can someone confirm? If TclParseNumber() is the right tool, this is evidence that we ought to make it public in 8.6 so that Tk 8.6 can continue to use only public interfaces of Tcl. jenglish added on 2010-05-09 05:34:47: This is, of course, The Octal Problem. Internally the spinbox calls Tcl_GetDouble() on the string value. In 8.4 Tcl_GetDouble just called strtod() (which does not suffer from the octal bug), in 8.5 it uses the TIP#249 facilities (which, alas, does). Reassigning to kbk for guidance -- what is the proper way for Tcl client code to get the equivalent of strtod() nowadays? teopetuk added on 2010-05-09 02:01:28: By the way, ttk::spinbox works fine in 8.6b1. dgp added on 2010-05-09 01:13:25: This looks bad; is it a simple fix or at least diagnosis among the Tk gurus? teopetuk added on 2010-05-08 12:04:00: The same bug is present in 8.6b1. | |||
