Debian Codegraph @

Tixish/examples/adjuster

raw
1 #!/usr/bin/perl -w
2 #
3 # A Tree with an adjustable text window to the right.
4 #
5 # Chris Dean <[email protected]>
6 # Achim Bohnet <[email protected]>
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;