"Fossies" - the Fresh Open Source Software Archive

Member "Tk-804.036/Tixish/examples/adjuster" (15 Nov 2013, 938 Bytes) of package /linux/misc/Tk-804.036.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/usr/bin/perl -w
    2 #
    3 # A Tree with an adjustable text window to the right.
    4 #
    5 # Chris Dean <ctdean@cogit.com>
    6 # Achim Bohnet <ach@mpe.mpg.de>
    7 
    8 use lib '..';
    9 
   10 use Tk;
   11 use Tk::Text;
   12 use Tk::Tree;
   13 
   14 use strict;
   15 
   16 my $mw = new MainWindow( -title => "Tree with adjuster" );
   17 
   18 my $t1 = $mw->Scrolled( qw/Text -wrap word -scrollbars osoe/ );
   19 
   20 my $list = $mw->Scrolled('Tree', -scrollbars=>'osoe', -separator => "\\" );
   21 
   22 $list->configure( -command => sub { my $d = shift;
   23                                     $t1->delete( qw/0.0 end/ );
   24                                     $t1->insert( "end", "$d " x 100 ) } );
   25 
   26 
   27 $list->packAdjust(-side => 'left', -fill => 'both', -delay => 1);
   28 $t1->pack(-side => 'right', -fill => 'both', -expand => 1);
   29 
   30 my @directories = qw( C: C:\Dos C:\Windows C:\Windows\System );
   31 
   32 foreach my $d (@directories) {
   33     my $text = (split( /\\/, $d ))[-1];
   34     $list->add( $d, -text => $text );
   35 }
   36 
   37 $list->autosetmode();
   38 
   39 MainLoop;