| 1 |
|
| 2 |
|
| 3 |
use Tk; |
| 4 |
|
| 5 |
use Tk::TableMatrix; |
| 6 |
|
| 7 |
use Data::Dumper qw( DumperX); |
| 8 |
my $top = MainWindow->new; |
| 9 |
|
| 10 |
my $arrayVar = {}; |
| 11 |
|
| 12 |
foreach my $row (0..20){ |
| 13 |
foreach my $col (0..10){ |
| 14 |
$arrayVar->{"$row,$col"} = "r$row, c$col"; |
| 15 |
} |
| 16 |
} |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
my $t = $top->Scrolled('TableMatrix', -rows => 21, -cols => 11, |
| 21 |
-width => 6, -height => 6, |
| 22 |
-titlerows => 1, -titlecols => 1, |
| 23 |
-variable => $arrayVar, |
| 24 |
-selectmode => 'extended', |
| 25 |
-resizeborders => 'both', |
| 26 |
-titlerows => 1, |
| 27 |
-titlecols => 1, |
| 28 |
-bg => 'white', |
| 29 |
# -state => 'disabled' |
| 30 |
# -colseparator => "\t", |
| 31 |
# -rowseparator => "\n" |
| 32 |
); |
| 33 |
|
| 34 |
$t->tagConfigure('active', -bg => 'gray90', -relief => 'sunken'); |
| 35 |
$t->tagConfigure( 'title', -bg => 'gray85', -fg => 'black', -relief => 'sunken'); |
| 36 |
|
| 37 |
# $t->bind("<Any-Enter>", sub { $t->focus }); |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
$t->pack(-expand => 1, -fill => 'both'); |
| 42 |
|
| 43 |
Tk::MainLoop; |