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

Tcl/Tk default widget color

0 views
Skip to first unread message

LocO

unread,
Feb 20, 2002, 2:28:48 AM2/20/02
to
I was wondering if someone may be able to point me in the right
direction, I currently have a modified Mandrake 8.1 install, and I had to
upgrade the Iwidgets package to 4.0.0, and after I did that the default
widget colors screwed up.

If you do any tcl/tk programming using Iwidgets
on a mandrake install you may know what I'm talking about, the mandrake
rpm's are rather broken, or atleast I haven't been able to get them to
work correctly.

So the origional question stands, is there a config file where these
defaults are stored so to change them back to a readable default.

Ex: in a normal widget the default settings are as follows for a text
widget: [wishx command on .text widget: 'join [.test config] \n' to see for
yourself]
-foreground foreground Foreground Black black
-highlightbackground highlightBackground HighlightBackground #d9d9d9
#d9d9d9
-highlightcolor highlightColor HighlightColor Black Black

on my broken install, they output as follows.
well, I was going to, but I can't get the info from an ssh session at the
moment, suffice it to say, atleast the highlightbackground has a
different default other than #d9d9d9.

So... Help please.
Tony

Jeff Hobbs

unread,
Feb 20, 2002, 2:16:39 PM2/20/02
to
LocO wrote:
> I was wondering if someone may be able to point me in the right
> direction, I currently have a modified Mandrake 8.1 install, and I had to
> upgrade the Iwidgets package to 4.0.0, and after I did that the default
> widget colors screwed up.
...

> moment, suffice it to say, atleast the highlightbackground has a
> different default other than #d9d9d9.

I don't use Mandrake, but it may be that they are like CDE/VUE in
that they set global Xdefaults to try and establish a similar
look and feel between apps that isn't always correct. If so, the
following answer should help:

http://www.tcl.tk/community/hobbs/tcl/faqs/tk/

[Question 2.8]
2.8. Why does Tk look funny in CDE/VUE?
The problem is that this strangely designed window managers set X resources
for *foreground, *background, *Font, etc..., which gets imposed on Tk. The
real problem is that CDE apps rely on these resources being set (no sane
defaults). The following is a quick wrapper solution.

The solution is provided as a shell script which wraps around any Tk
program which you might normally run. It is assumed that you have xrdb and
the program in your regular path. If this is how you normally launch your
app:

tkcon -slave "lappend auto_path /my/dir" &
then you would now do: (notice that the wrapper backgrounds automatically)

uncde tkcon -slave "lappend auto_path /my/dir"
#!/bin/sh
#
# uncde
#
# This script will temporarily remove those lame global resource bindings
# that screw with Tk applications. It launches the Tk app (which is
assumed
# to be in your path), gives it a few seconds to load up, and then restores
# the old resources.
#
# Example usage: uncde tkcon -slave "set a 50"

if test ! "$1"; then
echo "usage: $0 command options"
exit
fi

## Cache the old resources
OLD_RESOURCES=`xrdb -query`

## Remove what we didn't want
echo "removing *foreground, *background and *Font resources"
xrdb -remove <<STOP
*foreground:
*Font:
*background:
STOP

exec ${1+"$@"} &
echo "\"$1\" backgrounded as process $!"

## Give time for Tk to load up and avoid the old resources
sleep 3

## Add back the old stuff
echo "resetting all resources to defaults"
xrdb -merge <<STOP
$OLD_RESOURCES
STOP

--
Jeff Hobbs The Tcl Guy
Senior Developer http://www.ActiveState.com/
Tcl Support and Productivity Solutions
http://www.ActiveState.com/Products/ASPN_Tcl/

0 new messages