Thread Ausgabe in Entry (2 answers)
Opened by Gast at 2007-09-03 10:58

renee
 2007-09-03 11:22
#99014 #99014
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
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
#!/usr/bin/perl

use strict;
use warnings;
use Tk;

my $text  = '';
my $text2 = '';
my $rbv   = '';

my $mw    = tkinit;
   $mw->Entry( -textvariable => \$text )->pack;  # fuege das Entry-Feld hinzu
my $cb1   = $mw->Radiobutton( -text => 'Radiobutton1', -value => 1, -variable => \$rbv )->pack;
my $cb2   = $mw->Radiobutton( -text => 'Radiobutton2', -value => 2, -variable => \$rbv )->pack;
my $btn   = $mw->Button( -text => 'Ok', -command => \&button_clicked )->pack;
my $entry = $mw->Entry( -textvariable => \$text2 )->pack;

MainLoop;

sub button_clicked{
    if( $rbv == 1 ){
        fill_text1();
    }
    elsif( $rbv == 2 ){
        fill_text2();
    }
    else{
        $text2 = 'Fehler!';
    }
}

sub fill_text1{
    $text2 = 'Sie haben eingegeben: ' . $text;
}

sub fill_text2{
    $text2 = 'Ihr Text: ' . $text;
}
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread Ausgabe in Entry