Thread TableMatrix : window resize: Window Hoehe (2 answers)
Opened by Gast at 2007-04-05 11:06

Gast Gast
 2007-04-05 11:06
#46281 #46281
Hallo,

ich moechte die Hoehe einer TableMatrix die sich in einem Frame befindet, diesen aber der Hoehe nach nicht ausfuellt nachtraeglich veraendern (z.B. weil sich eine rowHeighth geaendert hat). Mit packForget und nochmal packen geht's nicht. Wie macht man das ?

Anbei ein Beispiel - beim ckick auf den Button wird die Hoehe der row 2 erhoeht.

Code (perl): (dl )
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');
}


---
Modedit Gwendragon: Für Code bitte den Code- oder Perl-Tag verwenden. Siehe iBCode
---\n\n

<!--EDIT|GwenDragon|1175762592-->

View full thread TableMatrix : window resize: Window Hoehe