Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Tk 8.5.1: unknown color name {#d9d9d9}

23 views
Skip to first unread message

Ralf Fassel

unread,
Feb 27, 2008, 2:50:31 PM2/27/08
to
$ wish8.5
% info patchlevel
8.5.1

In 8.5.1 I get an unexpected difference when using 'list' vs the
quoted form of a color name:

% option add *Background \#d9d9d9 widgetDefault
% entry .foo
.foo

% option add *Background {#d9d9d9} widgetDefault
% entry .bar
.bar

These are both ok. However:

% option add *Background [list #d9d9d9] widgetDefault
% entry .baz
unknown color name "{#d9d9d9}"

This breaks Tix widget classes in 8.5.x which use the #dddddd form to
specify color defaults.

I don't see this in 8.4.x.

Can anyone confirm this? Bug or feature?
R'

Bryan Oakley

unread,
Feb 27, 2008, 3:12:43 PM2/27/08
to
Ralf Fassel wrote:
> $ wish8.5
> % info patchlevel
> 8.5.1
>
> In 8.5.1 I get an unexpected difference when using 'list' vs the
> quoted form of a color name:
>
> % option add *Background \#d9d9d9 widgetDefault
> % entry .foo
> .foo
>
> % option add *Background {#d9d9d9} widgetDefault
> % entry .bar
> .bar
>
> These are both ok. However:
>
> % option add *Background [list #d9d9d9] widgetDefault
> % entry .baz
> unknown color name "{#d9d9d9}"

The above is simply wrong. The option takes a string, not a list. What
is happening is that Tcl creates a list, converts it to a string, and
passes that to the option command.

You'll notice that with 8.5, the string representation of [list #d9d9d9]
is "{#d9d9d9}", which is perfectly acceptable even though it's different
than 8.4.

> This breaks Tix widget classes in 8.5.x which use the #dddddd form to
> specify color defaults.

#dddddd is fine. Using [list #dddddd] is incorrect usage on the part of
the Tix code and/or your application.


--
Bryan Oakley
http://www.tclscripting.com

Ralf Fassel

unread,
Feb 27, 2008, 3:24:56 PM2/27/08
to
* Bryan Oakley <oak...@bardo.clearlight.com>

| #dddddd is fine. Using [list #dddddd] is incorrect usage on the part
| of the Tix code and/or your application.

Thanks for checking, Bryan.

The code in question is in tixClass.c, static int SetupDefault(...),
#1120ff:

if (Tix_GlobalVarEval(interp, "option add *", cPtr->ClassName,
p->spec, " [list ", p->value, "] widgetDefault",
NULL) != TCL_OK) {

where cPtr->ClassName, p->spec and p->value are const char*.
Tix_GlobalVarEval() simply concatenates all the arguments in a string
and passes this on to Tcl_EvalEx().
This code was there in the initial CVS revision of that file on
Sourceforge... :-/

I guess the correct way would be to set up a proper list of TclObj*
arguments and pass this to Tcl_EvalObjv().

R'

Ralf Fassel

unread,
Feb 27, 2008, 4:08:31 PM2/27/08
to
* Ralf Fassel <ral...@gmx.de>

| I guess the correct way would be to set up a proper list of TclObj*
| arguments and pass this to Tcl_EvalObjv().

Attached a possible fix to
[ 1864027 ] bogus handling of #color in -defaults class option
on Sourceforge.

R'

Jeff Hobbs

unread,
Feb 27, 2008, 11:54:21 PM2/27/08
to
On Feb 27, 11:50 am, Ralf Fassel <ralf...@gmx.de> wrote:
> $ wish8.5
> % info patchlevel
> 8.5.1
>
> In 8.5.1 I get an unexpected difference when using 'list' vs the
> quoted form of a color name:
...

> This breaks Tix widget classes in 8.5.x which use the #dddddd form to
> specify color defaults.

There is a new Tix 8.4.3 in CVS that addresses all 8.5 issues as well
as cleaning up other bits.

Jeff

Ralf Fassel

unread,
Feb 28, 2008, 1:08:45 PM2/28/08
to
* Jeff Hobbs <jeff....@gmail.com>

| There is a new Tix 8.4.3 in CVS that addresses all 8.5 issues as
| well as cleaning up other bits.

Thanks, Jeff, 8.4.3 has already been grabbed ;-)

R'
...may I draw your attention to tix bug-id 1165876?
This one annoys me every time I build a new tix...
It's a simple typo-fix, 'Background' misspelled 'Bacground' several times.

Jeff Hobbs

unread,
Feb 28, 2008, 5:45:27 PM2/28/08
to
On Feb 28, 10:08 am, Ralf Fassel <ralf...@gmx.de> wrote:
> * Jeff Hobbs <jeff.ho...@gmail.com>

Applied with a few other fixes.

Jeff

0 new messages