Leser: 2
5 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
#!/usr/bin/perl
use strict;
use warnings;
use Tk;
use Tk::BrowseEntry;
my $mw = tkinit(-title => 'test');
my $selected;
my $browse = $mw -> BrowseEntry(-variable => \$selected)
->pack();
my $b1 = $mw->Button(-text => 'fill in something',
-command => sub{ &fill_browse($selected) }
)
->pack();
MainLoop;
sub fill_browse {
my $selected = shift;
$selected = 0 unless $selected; #prevent warnings
my @elements = qw/ein zwei drei vier fuenf sechs sieben acht neun zehn/;
$browse->delete(0, 'end');
for (@elements) {
$browse->insert('end', $_) unless ($_ eq $selected);
}
}
5 Einträge, 1 Seite |