spinbox bug?

This is a discussion on spinbox bug? within the TCL forums in Programming Languages category; 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...

Go Back   Application Development Forum > Programming Languages > TCL

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-27-2008, 07:58 AM
Hanz
Guest
 
Default spinbox bug?

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
Reply With Quote
  #2  
Old 08-27-2008, 08:47 AM
suchenwi
Guest
 
Default Re: spinbox bug?

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
Reply With Quote
  #3  
Old 08-27-2008, 09:16 AM
Hanz
Guest
 
Default Re: spinbox bug?

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
Reply With Quote
  #4  
Old 08-27-2008, 09:28 AM
suchenwi
Guest
 
Default Re: spinbox bug?

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.
Reply With Quote
  #5  
Old 08-27-2008, 10:51 AM
Hanz
Guest
 
Default Re: spinbox bug?

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
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 08:28 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.