From: Larry W. Virden on
A developer recently asked me to help him solve an issue. Here's a
program that no longer displays as intended when moved from Tk 8.4 to
Tk 8.5

#! /usr/tcl84/bin/tclsh8.4
package require Tk

set type serial
set type2 N

font create lab -family helvetica -size 12 -weight bold
font create lab10 -family helvetica -size 10 -weight bold

proc nullcmd {} {
puts "8.4 default radiobutton $::type"
return 0
}

proc nullcmd2 {} {
puts "8.4 default checkbutton $::type2"
return 0
}

set left1 [frame .f1 -bg lightyellow -relief flat]

set area0 [frame $left1.s -bg lightyellow -relief flat]

label $area0.title -text "Radiobutton..." -font lab10 -bg springgreen2
\
-anchor w -justify left
radiobutton $area0.b1 -text "Serial" -variable type -value "serial" \
-takefocus 0 -font lab10 -bg palegreen1 \
-anchor w -justify left \
-selectcolor red -command nullcmd
radiobutton $area0.b3 -text "Non-Serial" -variable type -value
"nonser" \
-takefocus 0 -font lab10 -bg palegreen1 \
-anchor w -justify left \
-selectcolor red -command nullcmd
pack $area0.title $area0.b1 $area0.b3 -fill x -side top
pack $area0 -side top -pady 5

set checkb [checkbutton $area0.cb -text "Checkbutton..." -variable
type2 \
-onvalue "Y" -offvalue "N" \
-takefocus 0 -bd 3 -relief groove -font lab \
-command nullcmd2 \
-bg MistyRose -selectcolor red -activebackground white]
pack $checkb -padx 5 -side left

pack $left1 -side left


The goal for this developer is to end up with a Tk 8.5 application
that is identical to the Tk 8.4 one.
When the above code runs against Tk 8.4, the behavior is as expected
and coded. When the above code runs against Tk 8.5, the -selectcolor
appears in each radio or check button created, whether it is selected
or not.

The radiobutton manpage states, for selectcolor:

Specifies a background color to use when the button is
selected. If indicatorOn is true then the color applies to
the indicator. Under Windows, this color is used as the
background for the indicator regardless of the select state.
If indicatorOn is false, this color is used as the back-
ground for the entire widget, in place of background or
activeBackground, whenever the widget is selected. If
specified as an empty string then no special color is used
for displaying when the widget is selected.

It is not clear to me whether the "Under Windows" means "when the Tk
application runs on Windows" or if it means "when the Tk application
DISPLAYS on Windows".

In our case, the applications are running on a Solaris machine,
displaying back to a Windows machine via Cygwin/X .

I'm just wondering whether the difference we are seeing reflects a
change in Tk which has not yet made it to the man page, a bug in Tk
8.5 and 8.6, or a problem when Tk 8.5 displays back to a Windows-based
X server.


From: Larry W. Virden on
On Feb 19, 9:50 am, drscr...(a)gmail.com wrote:
> I am using 8.4.17 and I see no change in any colors whether the buttons
> are selected or not.  The ticks are always red, and option box labels
> are in green background and the checkbutton label background is pinkish.

We are using Tk 8.4.9 (built from the formal release of the source).
Upon the start of the program, we see the radio buttons with a light
green background, the serial button a red diamond indicating it is
selected and the non-serial button the black outline of an unselected
diamond. The bisque check button has a raised relief square
unselected indicator that is a black outline - it turns red after
selection.

When we use Tk 8.5.7, all radio buttons and check buttons display red.
The selected button has a _tiny_ black dot to indicate whether it was
selected.

So, if one wants to use Tk 8.5, but wants the look of Tk 8.4, are they
out of luck, or just have to write from scratch their own widgets? Or
is there a way, via options, etc. to achieve the original look?
From: Larry W. Virden on
On Feb 19, 10:10 am, Arndt Roger Schneider <arndt.ro...(a)web.de> wrote:

> >The radiobutton manpage states, for selectcolor:
>
> >          Specifies a background color to use when the button is
> >          selected.  If indicatorOn is true then the color applies to
> >          the indicator.  Under Windows, this color is used as the
> >          background for the indicator regardless of the select state.
> >          If indicatorOn is false, this color is used as the back-
> >          ground for the entire widget, in place of background or
> >          activeBackground, whenever the widget is selected.  If
> >          specified as an empty string then no special color is used
> >          for displaying when the widget is selected.
>
> The entry inside the manual page is outdated.


When I read problem ticket
https://sourceforge.net/tracker/index.php?func=detail&aid=1083838&group_id=12997&atid=112997
, which seems to say that it is a closed fixed ticket, I get the
impression that a maintainer also thought the man page was out of date
and should be fixed. However, it doesn't seem to me as if the current
reading reflects the current strange behavior.
From: Larry W. Virden on
On Feb 19, 10:21 am, Donald G Porter <d...(a)nist.gov> wrote:
> Larry W. Virden wrote:
> > A developer recently asked me to help him solve an issue.  Here's a
> > program that no longer displays as intended when moved from Tk 8.4 to
> > Tk 8.5
>
> <snip without reading>
>
> Did you try [tk::classic::restore] ?
>
> DGP

Yes, it doesn't help with the selectcolor problem. Thanks for the
suggestion though.
From: Larry W. Virden on
On Feb 22, 7:02 am, Koen Danckaert <k...(a)spam.spam> wrote:
> Larry,
>
> I don't know if you remember, but you once asked a similar question, and one of the ideas that came out was to add a trace to the radiobutton variable, in which you can then modify the colors of the buttons depending on which one is selected.
>
> http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/9c3...
>
> Koen

Thanks. I appreciate the reminder and I'll let the developer know. As
you can imagine, having to add code to a number of applications just
so the application works the same as it did in the older version will
likely be frustrating, but if that's the only option available, then I
guess that is it.

Thank you again.