Leser: 2
8 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
#!/usr/bin/perl
use strict;
use warnings;
use Tk;
use Tk::HList;
my $mw = tkinit();
my $hlist = $mw->HList()->pack();
my $btn = $mw->Button(-text => 'auslesen',
-command => \&read_entry)->pack();
fill_list();
MainLoop;
sub fill_list{
for(0..4){
$hlist->add($_, -itemtype => 'text', -text => $_);
}
}
sub read_entry{
my $data = $hlist->entrycget(2,'-text');
print $data,"\n";
}
$hlist->bind('<Button-1>', \&read_entry);
1
2
3
$hlist->itemCreate($i, 0, -text => $string);
$hlist->itemCreate($i, 1, -text => $string);
$hlist->itemCreate($i, 2, -text => $string);
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
#!/usr/bin/perl -w
use strict;
use Tk;
use Tk::HList;
my $main = tkinit();
my $hlist = $main->HList(-columns => 3)->pack(-fill => 'both', -expand => 1);
my $row = 0;
#irgendwas hinzufuegen
for my $col (0..2) {
$hlist -> add($row);
$hlist->itemCreate($row, $col, -itemtype => 'text', -text => "row: $row col: $col");
$row++;
}
#ausgabe
$main -> Button(-text => 'Print', -command => sub{print_out()})->pack;
MainLoop;
sub print_out {
#2,2 is letzte zeile, letzte spalte
#1,1 is zweite zeile, zweite spalte usw
my $outside = $hlist->itemCget(2, 2, -text);
print $outside ."\n";
}
8 Einträge, 1 Seite |