Version 3 of option

Updated 2002-09-13 13:31:02

http://purl.org/tcl/home/man/tcl8.4/TkCmd/option.htm


"option" acts on the "option database".


Chris Nelson notes:

 > I've changed to:
 > 
 >    # Why do these affect selection?
 >    option add *Entry.background red widgetDefault
 >    option add *Entry.foreground blue widgetDefault
 > 
 >    entry .e
 >    pack .e
 > 
 >    # Why is this only when the button is active?
 >    option add *Button.background red widgetDefault
 >    option add *Button.foreground green widgetDefault
 > 
 >    button .b -text Exit -command exit
 >    pack .b
 > 
 > And now the options seem to have no effect.

Based on a clue from Jeff in another conversation, I found that setting the priority to startupFile, instead of widgetDefault, was enough to get this to work. It seems Solaris' CDE does some funky color stuff.


Jeff replies:

More accurately, Solaris sets the equivalent of:

        *foreground
 and    *background

in the X defaults. Very lame way to control L&F, but that's what they chose. Those wanting to get around this can also see the solutions in the Tk Usage FAQ:

        http://www.purl.org/net/hobbs/tcl/faqs/tk/

See also http://www.cs.man.ac.uk/~fellowsd/tcl/option-tutorial.html


Tk syntax help - Arts and crafts of Tcl-Tk programming - Category Command