7 Einträge, 1 Seite |
my $note = $main->NoteBook(-dynamicgeometry => 'true')->pack();
my $note = $main->NoteBook(-dynamicgeometry => 'true')->pack();
1
2
3
4
5
6
7
8
9
10
11
12
13
use strict;
use warnings;
use Tk;
my $mw = tkinit;
my $note = $mw->NoteBook()->pack();
$note->{-dynamicgeometry} = 1;
my @pages = map {$note->add("page$_")} (0..3);
for (0..3){$pages[0]->Label(-text => 'label')->pack;}
for (0..20){$pages[1]->Label(-text =>'label')->pack;}
MainLoop;
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
use strict;
use warnings;
use Tk;
use Tk::NoteBook;
package Tk::NoteBook;
{
no warnings 'redefine';
sub Resize {
my ($w) = @_;
return unless Tk::Exists($w) && $w->{'nWindows'} && $w->{'resize'};
$w->InitTabSize;
$w->{'resize'} = 0;
my $reqW = $w->{-width} || 0;
my $reqH = $w->{-height} || 0;
if ($reqW * $reqH == 0)
{
# if ((not defined $w->{-dynamicgeometry}) || # NoteBook.pm line 393
# ($w->{-dynamicgeometry} == 0)) {
unless ($w->cget('-dynamicgeometry')){
$reqW = 1;
$reqH = 1;
my $childw;
foreach $childw ($w->page_widget)
{
my $cW = $childw->ReqWidth;
my $cH = $childw->ReqHeight;
$reqW = $cW if ($reqW < $cW);
$reqH = $cH if ($reqH < $cH);
}
} else {
if (defined $w->{'topchild'}) {
my $topw = $w->page_widget($w->{'topchild'});
$reqW = $topw->ReqWidth;
$reqH = $topw->ReqHeight;
} else {
$reqW = 1;
$reqH = 1;
}
}
$reqW += $w->{'pad-x1'} + $w->{'pad-x2'} + 2 * (defined $w->{-ipadx} ? $w->{-ipadx} : 0);
$reqH += $w->{'pad-y1'} + $w->{'pad-y2'} + 2 * (defined $w->{-ipady} ? $w->{-ipady} : 0);
$reqW = ($reqW > $w->{'minW'}) ? $reqW : $w->{'minW'};
$reqH = ($reqH > $w->{'minH'}) ? $reqH : $w->{'minH'};
}
if (($w->ReqWidth != $reqW) ||
($w->ReqHeight != $reqH)) {
$w->{'counter'} = 0 if (not defined $w->{'counter'});
if ($w->{'counter'} < 50) {
$w->{'counter'}++;
$w->GeometryRequest($reqW, $reqH);
$w->afterIdle([$w,'Resize']);
$w->{'resize'} = 1;
return;
}
}
$w->{'counter'} = 0;
$w->raise($w->{'topchild'} || ${$w->{'windows'}}[0]);
$w->{'resize'} = 0;
}
}
package main;
my $mw = tkinit;
my $note = $mw->NoteBook(-dynamicgeometry => 1)->pack();
my @pages = map {$note->add("page$_")} (0..3);
for (0..3){$pages[0]->Label(-text => 'label')->pack;}
for (0..20){$pages[1]->Label(-text =>'label')->pack;}
MainLoop;
7 Einträge, 1 Seite |