Skip Menu |

This queue is for tickets about the Tk CPAN distribution.

Report information
The Basics
Id: 30519
Status: resolved
Priority: 0/
Queue: Tk

People
Owner: Nobody in particular
Requestors: mattias.j.andersson [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Mega widgets and .Xdefaults
Date: Tue, 6 Nov 2007 16:10:39 +0100
To: bug-Tk [...] rt.cpan.org
From: "Mattias Andersson" <mattias.j.andersson [...] gmail.com>
Hi, I have a problem with Mega widgets and color preferences defined in my .Xdefaults. With this line in my .Xdefaults *Entry*Background: green The following program do not display the top most Tk::Entry with green backgound. This is the Tk::Entry contained in my Mega widget. The Tk::Entry at the bottom not contained in any other Widget has green background as expected. { package MyText; use strict; use warnings; use base qw(Tk::Derived Tk::Text); Construct Tk::Widget 'MyText'; sub Populate { my ($w, $args) = @_; $w->SUPER::Populate($args); my $e = $w->Entry()->pack; $w->Advertise('entry' => $e); } }; my $mw = new MainWindow; my $t = $mw->MyText()->pack; $mw->Entry()->pack; MainLoop; If I instead set my Tk::Entry as readonly. I can configure both with: *Entry*ReadonlyBackground With the following in my .Xdefaults: *Entry*ReadonlyBackground : blue Both my Tk::Entry gets a nice blue background with the following program: { package MyText; use strict; use warnings; use base qw(Tk::Derived Tk::Text); Construct Tk::Widget 'MyText'; sub Populate { my ($w, $args) = @_; $w->SUPER::Populate($args); my $e = $w->Entry(-state => 'readonly')->pack; $w->Advertise('entry' => $e); } }; my $mw = new MainWindow; my $t = $mw->MyText()->pack; $mw->Entry(-state => 'readonly')->pack; MainLoop; ; perl -MTk -e 'print $Tk::VERSION, "\n"' 804.027 ; uname -a SunOS uws146 5.8 Generic_117350-46 sun4u sparc SUNW,Sun-Fire-V210 ; perl -v This is perl, v5.8.8 built for sun4-solaris Copyright 1987-2006, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page.
This is actually a feature, which is sometimes undesirable. To solve your problem, you can use the information from the following paragraph, which I just added to the Tk::ConfigSpecs documentation. Regards, Slaven --- The -background and -foreground option values are automatically propagated down to all composite widget's children. This may be sometimes not desirable, especially if some subwidgets should use own color schemes, either by using explicit options or by option database definitions. If this is the case, then just add -foreground => 'SELF', -background => 'SELF', to ConfigSpecs. ---