Thread Widgets in Frame dynamisch erstellen/verändern (6 answers)
Opened by Ronnie at 2007-10-19 13:20

renee
 2007-10-19 13:34
#101099 #101099
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
#!/usr/bin/perl

use strict;
use warnings;
use Tk;
use Tk::Tree;

my $mw = tkinit;
my $tree   = $mw->Tree( -browsecmd => \&change )->pack;
my $frame  = $mw->Frame->pack;

my %labels = (
    test  => $frame->Label( -text => 'test' ),
    hallo => $frame->Label( -text => 'hallo' ),
);

for my $key ( keys %labels ){
    $tree->add( $key , -text => $key );
}

MainLoop;

sub change{
    my $item = shift;
    $_->packForget for $frame->children;
    $labels{$item}->pack;
}
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 Widgets in Frame dynamisch erstellen/verändern