## When I run the following perl script and try to edit a cell
content,
## the cell foreground colour becomes 'white' and backgroud colour
becomes 'white gray'.
## Therefore i can't see the contents of the cell clearly.
## This happens only at the time of editing,otherwise there is no
colour problem.
## I tried with various -bg and -fg but no help.
##
## How I could change the -fg and -bg while editing?
#
## I am using Windows XP, Strawberry perl 5.10.TableMatrix 1.23
#
#
## The same code runs on ubuntu 9.10 successfully.
## There is no colour problem while trying to edit cell.
##
## Thanks in advance...
## the script follows...
######################
#!perl -w
use Tk::TableMatrix;
use Tk;
my $var = {};
foreach my $row (0..4){
foreach my $col (0..4){
$var->{"$row,$col"} = "$row $col";
}
}
my $mw=tkinit;
my $tm = $mw->Scrolled('TableMatrix',
-scrollbars=>'osoe',
-bg=>'white',
-rows=>3,
-cols=>3,
-multiline=>0,
-variable=>\$var)->pack(-expand=>1, -fill=>'both');
MainLoop
Steve C - 08 Mar 2010 19:49 GMT
> ## When I run the following perl script and try to edit a cell
> content,
[quoted text clipped - 38 lines]
>
> MainLoop
All widgets inherit a bunch of color options which affect how they appear
under various circumstances. The code below is from the initialization of
the default color palette. Your defaults may not be the same on a different
system for 'insertBackground' for example. I didn't look through the TableMatrix
code to see what it does. You can change the defaults if you have a color
scheme that you want to apply to all widgets, or you can change it for one app,
or just one widget. Sometimes these things are too flexible.
$Palette{'activeBackground'} = ($c->configure('-activebackground'))[3] ;
$Palette{'activeForeground'} = ($c->configure('-activeforeground'))[3];
$Palette{'background'} = ($c->configure('-background'))[3];
$Palette{'disabledForeground'} = ($c->configure('-disabledforeground'))[3];
$Palette{'foreground'} = ($c->configure('-foreground'))[3];
$Palette{'highlightBackground'} = ($c->configure('-highlightbackground'))[3];
$Palette{'highlightColor'} = ($c->configure('-highlightcolor'))[3];
$Palette{'insertBackground'} = ($e->configure('-insertbackground'))[3];
$Palette{'selectColor'} = ($c->configure('-selectcolor'))[3];
$Palette{'selectBackground'} = ($e->configure('-selectbackground'))[3];
$Palette{'selectForeground'} = ($e->configure('-selectforeground'))[3];
$Palette{'troughColor'} = ($s->configure('-troughcolor'))[3];
Jack - 09 Mar 2010 03:16 GMT
> ## When I run the following perl script and try to edit a cell
> content,
[quoted text clipped - 36 lines]
> -multiline=>0,
> -variable=>\$var)->pack(-expand=>1, -fill=>'both');
################
$tm->tagConfigure('active',-bg=>'black', -fg=>'yellow');
################
> MainLoop
You can workaround this by providing a different color combination for the
"active" cell. See above line added to your code.
It seems to work for me - but the select color sometimes takes on the
"windows select color" depending on your theme/preferences. For instance -
sometimes the black and yellow turns into blue and white for me.
TableMatrix is also weird when it comes to "selecting" within the cell that
is selected. For instance you may have a long string within a cell and want
to only change 1 or 2 characters of that string. I don't know how to do
that?
Jack
Sibu - 10 Mar 2010 12:46 GMT
> > ## When I run the following perl script and try to edit a cell
> > content,
[quoted text clipped - 56 lines]
>
> Jack
Its solved by adding the line as you suggested
$tm->tagConfigure('active',-bg=>'white',-fg=>'black')
Thanks.
Sibu