#! /usr/bin/perl use strict; use warnings; use Tk; use Tk::Tree; use Tk::Label; my $top = new MainWindow( -title => "OSS NETWORK"); my $label = $top->Label(-width=>15); my $tree = $top->Scrolled( 'Tree', -separator => '/', -background => 'white', -foreground => 'blue', -relief => 'groove', -exportselection => 1, -scrollbars => 'oe', -height => 20, -width => 40, -itemtype => 'text', -selectmode => 'extended', -browsecmd => sub { my $DN = shift; $label->configure(-text=>$DN); } ); # Pack the tree. $tree->pack( -expand => 'yes', -fill => 'both', -padx => 15, -pady => 15, -side => 'top' ); $label->pack( -expand => 'yes', -fill => 'both', -padx => 15, -pady => 15, -side => 'top' ); # Pack the label. my @list = qw( PLMN-PLMN PLMN-PLMN/BSC-49567 PLMN-PLMN/BSC-49566 PLMN-PLMN/BSC-49560 PLMN-PLMN/BSC-49567/BCF-1 PLMN-PLMN/BSC-49567/BCF-5 PLMN-PLMN/BSC-49567/BCF-5/BTS-7 PLMN-PLMN/BSC-49567/BCF-2 PLMN-PLMN/BSC-49567/BCF-1/BTS-A); foreach ( '/', @list ) { my $text = (split( /\//, $_ ))[-1]; #If we're on /, let's make its label blank. # if ($_ eq '/') { $text = ""; } # Add the item (in $_) with $text as the label. # $tree->add( $_, -text => $text ); } $tree->autosetmode(); MainLoop();