[GRASS5] gis.m (2006.03.24): kudos and bugs
Cedric Shock
cedricgrass at shockfamily.net
Tue Apr 4 14:20:11 EDT 2006
Michael,
>
> The options panes in the GIS Manager main window. I just need the code you
> use to make mouse wheel bindings work in this area.
Sorry, I haven't gotten to this yet.
>
> We need to standardize on colors and put them in options.tcl. Here is my
> suggestion. I'm open to alternatives.
>
> GIS Manager and all window frames set by $bgcolor (or new equivalent).
> Currently this defaults to "honeydew".
The tk options database can control virtually everything from one place if and
only if we don't set the attributes we want to control. That means no colors,
no fonts, no colors set from global variables, etc.
Examples of labels that are impossible to control from the options database:
label .label0 -text "Unchangable Foreground" -fg darkblue
label .label1 -text "Unchangeable Font" -font fontname
label .label2 -text "Unchangable Background" -bg $bgcolor
label .label3 -text "Unchangable Everything" -bg $labelbgcolor -font
$labelfont -fg $labelfg ...
Example of label that can and will get font, foreground color, background
color, justification, anchoring, etc. all from the tk options database if
they are specified:
label .label4 -text "Correctly Styled Label"
This can be centrally controlled by commands like these:
option add *Label.background grey
option add *Label.foreground black
option add *Label.font uifont
Example of a bunch of labels that are really great for the tk options database
because they have distinctive, meaningful names.
label .layer0.layertypedescription -text "Raster"
label .layer1.layertypedescription -text "Vector"
label .layer2.layertypedescription -text "Raster"
label .layer3.layertypedescription -text "Compass Rose"
...
These can all be centrally controlled by commands like these:
option add *layertypedecription.foreground red
option add *layertypedecription.font typedesctiptionfont
>
> Options areas, including options panes, button bars, tabbed frames, and
> similar: set to grey (or a variable)
>
Just like for everything else, don't set them when the widget is created, even
with global variables. We can control them with the tk options database.
This command will set the background color of every entry box inside any
widget named optionpane to be red:
option add *optionpane*Entry.background red
> Widgets where the user needs to enter something, including entry widgets
> and text widgets: set to white (or a variable)
This is done magically by the following in options.tcl, as long as background
and font are not specified on Entry and Text widgets:
# Entry widgets and text widgets should have a white background
option add *Entry.background white
option add *Text.background white
option add *Entry.font textfont
option add *Text.font textfont
I hope this is starting to get clear. There is no really decent documentation
of the tk option command anywhere; the tcl 8.5 manual page is the first
version of the manual to have a single measly example. These are what I had
to go on when I sorted it all out in my head:
http://www.tcl.tk/man/tcl8.5/TkCmd/option.htm
http://www.cs.man.ac.uk/~fellowsd/tcl/option-tutorial.html
http://www.itworld.com/AppDev/4061/UIR000721regex/
--Cedric
More information about the grass-dev
mailing list