3 Einträge, 1 Seite |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
use Tk; use Tk::TableMatrix; my $top = MainWindow->new; my $screen_height = int(($top->screenheight) * 0.8); my $screen_width = int(($top->screenwidth ) * 0.95); my $geometry = $screen_width . 'x' . $screen_height; $top->geometry("$geometry-0+0"); my $arrayVar = {}; foreach my $row (0..20){ foreach my $col (0..10){ $arrayVar->{"$row,$col"} = "r$row, c$col"; } } my $button_frame=$top->Frame->pack(-side => 'top'); $button_frame->Button(-text => "Increase Row Height", -command => \&increase_row_height)->pack(-side => 'top', -anchor => 'center'); my $table_frame=$top->Frame(-background => '#b0c4df')->pack(-expand => 1, -side => 'top', -fill => 'both'); my $t = $table_frame->Scrolled('TableMatrix', -rows => 21, -cols => 11, -width => 11, -height => 21, -titlerows => 1, -titlecols => 1, -variable => $arrayVar, -selectmode => 'extended', -colstretchmode => 'all', -resizeborders => 'both', -bg => 'white', ); $t->tagConfigure('active', -bg => 'gray90', -relief => 'sunken'); $t->tagConfigure( 'title', -bg => 'gray85', -fg => 'black', -relief => 'sunken'); $t->pack(-fill => 'x'); Tk::MainLoop; sub increase_row_height { $t->rowHeight(2,4); $t->configure(-height => 25); $t->packForget; $t->pack(-fill => 'x'); }
3 Einträge, 1 Seite |