From: <no...@so...> - 2001-06-05 15:15:40
|
Bugs item #430116, was updated on 2001-06-04 13:49 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=112997&aid=430116&group_id=12997 Category: [option] Group: 8.4a3 Status: Open Resolution: None >Priority: 7 Submitted By: Christopher Nelson (chris_nelson) Assigned to: Nobody/Anonymous (nobody) Summary: [option get] behavior change Initial Comment: The following script works in Tcl/Tk 8.0 and Tcl/Tk 8.2 but fails in Tcl/Tk 8.4: proc jnl_entryState { e state } { switch -- $state { normal { $e configure \ -foreground [option get $e *Entry.Foreground Foreground] \ -background [option get $e *Entry.Background Background] } disabled { $e configure \ -foreground \ [option get $e *Entry.DisabledForeground DisabledForeground] \ -background \ [option get $e *Entry.DisabledBackground DisabledBackground] } } # switch } # jnl_entryState wm withdraw . toplevel .foo -class Foo set class [winfo class [winfo toplevel .foo]] option add *${class}*Entry.Foreground grey widgetDefault option add *${class}*Entry.DisabledForeground green widgetDefault option add *${class}*Entry.Background white widgetDefault option add *${class}*Entry.DisabledBackground blue widgetDefault entry .foo.e pack .foo.e button .foo.exit -text Done -command exit pack .foo.exit jnl_entryState .foo.e disabled In Tcl/Tk 8.4 it produces: Error in startup script: unknown color name "" (processing "-foreground" option) invoked from within "$e configure -foreground [option get $e *Entry.DisabledForeground DisabledForeground] -background [option get $e *Entry.DisabledBackground Disable..." ("disabled" arm line 2) invoked from within "switch -- $state { normal { $e configure -foreground [option get $e *Entry.Foreground Foreground] -background [option get $e *..." (procedure "jnl_entryState" line 2) invoked from within "jnl_entryState .foo.e disabled " (file "testOption.tcl" line 39) ---------------------------------------------------------------------- >Comment By: Donal K. Fellows (dkf) Date: 2001-06-05 08:15 Message: Logged In: YES user_id=79902 Fair enough; that's *definitely* wrong (unless you've got a very strange rgb.txt installed in your X server... :^) ---------------------------------------------------------------------- Comment By: Christopher Nelson (chris_nelson) Date: 2001-06-05 06:26 Message: Logged In: YES user_id=107514 Perhaps I was using [option get] incorrectly but it remains true that its behavior changed between versions. Also, here's a script which, I think, shows that it _is_ broken: % info patchlevel 8.4a3 % option add *Entry*background white widgetDefault % entry .e .e % .e configure -background -background background Background #d9d9d9 #0F8F7C007A31 Why didn't the entry get white as the default color? (This was on Solaris.) ---------------------------------------------------------------------- Comment By: Donal K. Fellows (dkf) Date: 2001-06-05 01:32 Message: Logged In: YES user_id=79902 I hate to be the bearer of bad news, but the key fault is with your code which does not follow the guidelines for using the [option get] command correctly. To illustrate what I mean, you should use: option get $e foreground Foreground instead of: option get $e *Entry.Foreground Foreground This probably means that we need to improve the error checking and documentation for [option get] to enforce the rules relating to names and classes of options (names must start with lower-case letter and classes must start with an upper-case letter and neither can contain periods, asterisks or question-marks. Other punctuation is legal IIRC but non-useful...) ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=112997&aid=430116&group_id=12997 |