| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| Hi All, I'm using a spinbox to control a timer. For the hour setting I would like numbers 00, 01, .., 23. So I use options: -from 0 -to 23 -increment 1 -width 2 -format "%02.0f" However, when operating the spinbox arrows, I can go up to 08, but from there instead of going to 09 the box resets to 00. Adding a validation command which always returns 1 does not help. Changing the format to "%2.0f" avoids the problem, possibly because then values like '09' which can be interpreted as a bad octal do not occur. -- Hans |
|
#2
| |||
| |||
| On 27 Aug., 13:58, Hanz <h...@nospam.nl> wrote: > Hi All, > > I'm using a spinbox to control a timer. For the hour setting I would > like numbers 00, 01, .., 23. So I use options: > -from 0 -to 23 -increment 1 -width 2 -format "%02.0f" > > However, when operating the spinbox arrows, I can go up to 08, but from > there instead of going to 09 the box resets to 00. > Adding a validation command which always returns 1 does not help. > Changing the format to *"%2.0f" avoids the problem, possibly because > then values like '09' which can be interpreted as a bad octal do not occur. > > -- Hans To avoid this yet another incarnation of the octal problem, you might just give a values list: pack [spinbox .s -values { 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 }] instead of -from, -to, -format, -increment |
|
#3
| |||
| |||
| Hi suchenwi, > > To avoid this yet another incarnation of the octal problem, you might > just give a values list: > pack [spinbox .s -values { > 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 > 22 23 > }] > instead of -from, -to, -format, -increment Thanks, yes, I tried this, but to my surprize you can see still funny behavior around with the '09' list element, as if it is somehow still inspected. Still, I guess this is the only solution... Cheers, Hans |
|
#4
| |||
| |||
| On 27 Aug., 15:16, Hanz <h...@nospam.nl> wrote: > > To avoid this yet another incarnation of the octal problem, you might > > just give a values list: > > pack [spinbox .s -values { > > * *00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 > > 22 23 > > }] > > instead of -from, -to, -format, -increment > > Thanks, yes, I tried this, but to my surprize you can see still funny > behavior around with the '09' list element, as if it is somehow still > inspected. Still, I guess this is the only solution... If you do any arithmetic with the strings 08 and 09, you'd better [scan] the numeric value out of them before doing that. Just spinning over them shows no problem here. |
|
#5
| |||
| |||
| suchenwi wrote: > On 27 Aug., 15:16, Hanz <h...@nospam.nl> wrote: >>> To avoid this yet another incarnation of the octal problem, you might >>> just give a values list: >>> pack [spinbox .s -values { >>> 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 >>> 22 23 >>> }] >>> instead of -from, -to, -format, -increment >> Thanks, yes, I tried this, but to my surprize you can see still funny >> behavior around with the '09' list element, as if it is somehow still >> inspected. Still, I guess this is the only solution... > > If you do any arithmetic with the strings 08 and 09, you'd better > [scan] the numeric value out of them before doing that. Just spinning > over them shows no problem here. Right, I had a validation command still checking the field for non-integer user entry, and indeed the 'string is integer 09' fails. Tricky! Thanks, Hans |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.