~ubuntu-branches/ubuntu/warty/perl-tk/warty

1 by Stephen Zander
Import upstream version 800.024
1
#!/usr/local/bin/nperl -w
2
3
use lib qw(blib .);
4
use Tk;
5
require Tk::HList;
6
7
$mw = MainWindow->new;
8
9
my $hl = $mw->Scrolled('HList', -separator => '.', -width => 25, 
10
                        -drawbranch => 1,
11
                        -selectmode => 'extended', -columns => 2,
12
                        -indent => 10);
13
14
$hl->configure( -command => [ sub 
15
                               {
16
                                my $hl = shift;
17
                                my $ent = shift;
18
                                my $data = $hl->info('data',$ent);
19
                                foreach ($hl,$ent,$data)
20
                                 {
21
                                  print ref($_) ? "ref $_\n" : "string $_\n";
22
                                 }
23
                                print "\n";
24
                               }, $hl
25
                             ]
26
               );
27
28
$hl->pack(-expand => 1, -fill => 'both');
29
30
@list = qw(one two three);
31
32
my $i = 0;
33
foreach my $item (@list)
34
 {
35
  $hl->add($item, -itemtype => 'text', -text => $item, -data => {});
36
  my $subitem;
37
  foreach $subitem (@list)
38
   {
39
    $hl->addchild($item, -itemtype => 'text', -text => $subitem, -data => []);
40
   }
41
 }
42
43
MainLoop;