Hello
This is really a low priority question, but been myself a perfectionist in UI design, I was wondering if there is a possibility to set the color Tablematrix uses when a cell/row is selected/in focus/highlighted (I do not know how to express it, sorry). Standard is a a quite old fashioned blue. I tried with $t->tagRow('active',$row); but this is actually not the right way. I can see the selection going blue and then getting the set color (not to mention that I have not implemented the way to reset the original color when another row is selected.
#!/usr/bin/perl
use warnings;
use strict;
use Tk;
use Tk::TableMatrix;
my $mw = MainWindow->new;
my $arrayVar = {};
print "Filling Array...\n";
my ($rows,$cols) = (10, 10);
foreach my $row (0..($rows-1)){
foreach my $col (0..($cols-1)){
$arrayVar->{"$row,$col"} = "$row,$col";
}
}
print "Creating Table...\n";
sub colSub{
my $col = shift;
return "OddCol" if( $col > 0 && $col%2) ;
}
sub rowSub{
my $row = shift;
return "Oddrow" if( $row > 0 && $row%2) ;
}
my $t = $mw->Scrolled('TableMatrix', -rows => $rows, -cols => $cols,
-width => 6, -height => 6,
-titlerows => 1, -titlecols => 1,
-variable => $arrayVar,
-coltagcommand => \&colSub,
-browsecommand => \&coloring,
-colstretchmode => 'last',
-rowtagcommand => \&rowSub,
-rowstretchmode => 'last',
-selectmode => 'extended',
-selecttitles => 0,
-drawmode => 'slow',
-scrollbars=>'se',
-relief => 'ridge',
-selectmode => 'extended',
-selecttype=>'row',
);
# Color definitions here:
$t->tagConfigure('active', -bg => 'lightyellow', -fg => 'red', -relief
+ => 'sunken');
$t->pack(-expand => 1, -fill => 'both');
$t->focus;
$t->configure (-state=>'disabled');
Tk::MainLoop;
sub coloring {
print "COLORING SELECTED ROW...\n";
my ($previous_index, $actual_index) = @_;
my ($row, $col) = split ',', $actual_index;
$t->tagRow('active',$row);
}