2016-03-07
| ||
21:12 | • Closed ticket [841280ff]: spinbox -from and -to defaults/behaviour plus 6 other changes artifact: 022be554 user: fvogel | |
21:10 | Fixed bug [841280] - spinbox -from and -to defaults and behaviour check-in: 27510927 user: fvogel tags: trunk | |
2016-02-25
| ||
14:40 | • Ticket [841280ff] spinbox -from and -to defaults/behaviour status still Open with 8 other changes artifact: 6c4564c1 user: fvogel | |
14:40 | Fixed bug [841280] - spinbox -from and -to defaults and behaviour Closed-Leaf check-in: 396dcfce user: fvogel tags: bug-841280ffff | |
2006-03-31
| ||
14:56 | • Ticket [841280ff] spinbox -from and -to defaults/behaviour status still Open with 5 other changes artifact: 75d24af9 user: hobbs | |
2004-11-19
| ||
16:30 | • Open ticket [841280ff]. artifact: 98b64aeb user: oox | |
02:26 | • Pending ticket [841280ff]. artifact: 2d905498 user: hobbs | |
2004-11-18
| ||
16:06 | • Open ticket [841280ff]. artifact: eccd4897 user: oox | |
04:20 | • Pending ticket [841280ff]. artifact: 1feea2e3 user: hobbs | |
2003-11-13
| ||
09:02 | • New ticket [841280ff]. artifact: a243a46e user: oox | |
Ticket UUID: | 841280 | |||
Title: | spinbox -from and -to defaults/behaviour | |||
Type: | Bug | Version: | None | |
Submitter: | oox | Created on: | 2003-11-13 09:02:23 | |
Subsystem: | 17. [spinbox] | Assigned To: | fvogel | |
Priority: | 6 | Severity: | Minor | |
Status: | Closed | Last Modified: | 2016-03-07 21:12:12 | |
Resolution: | Fixed | Closed By: | fvogel | |
Closed on: | 2016-03-07 21:12:12 | |||
Description: |
Not sure if this qualifies as a bug ... I want to configure the allowed range for a spinbox from 10 to 20: % info tclversion 8.4 (bin) 2 % spinbox .s .s (bin) 3 % .s configure -from 10 -to value must be greater than -from value As the defaults for Tk's spinbox -from and -to are both zero, it follows that I'm forced to first change the -to value followed by the -from one, or change both at once. My impression is that the defaults should be from MININT to MAXINT or some such. Notice that the defaults for Tk's scale -from and -to are 0.0 and 100.0, respectively. Other solution suggested in comp.lang.tcl was the following: rather than bailing out, autoadjust the "other" end to be equal to the one currently set. (except if both are set in one go) | |||
User Comments: |
fvogel added on 2016-03-07 21:12:12:
Merged to trunk (8.7) only. This is my conservative decision in full agreement with myself since no other voice was raised. fvogel added on 2016-02-25 14:40:18: I have been mumbling on this quite a bit and I think there is another way, that was not yet mentioned AFAIK: if "-from" is larger than "-to", just swap their values before using them. With this: - no error anymore when saying "spinbox .s -from 10": -to receives 10, and -from receives the default from -to (i.e. 0). - programmer may now specify -from and -to in any order, in separate instruction lines (i.e. in several steps) or in the same configuring statement - no complicated auto-altering of direction since in fine we still always have -from <= -to I have proposed this fix in branch bug-841280ffff. The only backwards compatibility concern I have is if a script relies on the error that used to trigger when -from is greater than -to. Despite I cannot find such a use case, I cannot 100% exclude this possibility. Is it really an issue in your opinion as far as merging the fix in trunk is concerned? hobbs added on 2006-03-31 14:56:25: Logged In: YES user_id=72656 See also 1439266 oox added on 2004-11-19 16:30:04: Logged In: YES user_id=662619 I don't understand the argument you use to not change the defaults. Using the spinbox with a list via de -values option simply dismisses the -from, -to and -increment options, so that their defaults would no longer apply. Again, in my opinion, changing the -from/-to defaults (may be together with those of [scale]) is the best option. I've been thinking about your idea of auto-altering the direction, but I don't come up with any alternative I really like. The best option I can think of along these lines is to allow -from > -to and using the absolute value of -increment so that pressing up always goes from -from to -to, but that's incompatible with the (arguable) current behaviour that -increment may be negative so that pressing the spinbox up button *decrements* the spinbox value. Notice this behaviour would reduce the gap between the spinbox and scale widgets which, albeit both having the -from/-to concept, they currently behave quite differently. hobbs added on 2004-11-19 02:26:10: Logged In: YES user_id=72656 But the example of inconvenience is impractical because a user should just write: .s configure -from 10 -to 20 and there is no error, even though the from comes first in the list of options. The reason to not change defaults is because of the overloaded purpose of the spinbox (that either numbers or a list can be used). We could consider a smarter -from/-to that auto-alters direction, but a patch for that would be appreciated. oox added on 2004-11-18 16:06:19: Logged In: YES user_id=662619 I agree that magically changing the options may not be a good option, but what about changing the -from and -to defaults which are currently both set to zero? Notice that those of Tk's scale are 0.0 and 100.0! This problem has shown up because we are building derived widgets using [incr Tk]. In that case, one does not have precise control on the order in which options get propagated to the base widget. For our extended spinbox widget we have been forced to add quite a bit of logic to work around this behaviour of Tk's spinbox. I find it "inconvenient" that spinbox .s .s configure -from 10 .s configure -to 20 throws an error while setting -from to 10, while spinbox .s .s configure -to 20 .s configure -from 10 works as expected. That reminds me of context-sensitive Perl. Notice that Tk's scale allows from > to: the direction of increment of the scale changes. May you please reconsider your position? hobbs added on 2004-11-18 04:20:42: Logged In: YES user_id=72656 As it's doc'ed, I'd like to leave this as is. It's just another option for the user to specify, and to magically change the options around might confuse users later requesting the actual value. |