Thread Eingabeformate: Tk (6 answers)
Opened by alexus-777 at 2004-04-25 13:14

coax
 2004-04-25 18:20
#41978 #41978
User since
2003-08-11
457 Artikel
BenutzerIn
[default_avatar]
'N kleiner Loesungsvorschlag
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/perl
use Tk;

my($text1, $text2);
my $max_len = 8;

my $mw = tkinit;

my $entry1 = $mw->Entry(-textvariable => \$text1)->pack();
my $entry2 = $mw->Entry(-textvariable => \$text2)->pack();

$entry1->bind('<Key>' => sub { $text1 = substr($text1, 0, $max_len);
                              $entry2->focus() if length($text1) == $max_len;
                              });
$entry2->bind('<Key>' => sub { $text2 = substr($text2, 0, $max_len); });

MainLoop();


Grusz Christian.
,,Das perlt aber heute wieder...'' -- Dittsche

View full thread Eingabeformate: Tk