| 1 |
#!/usr/local/bin/perl -w |
| 2 |
use Tk; |
| 3 |
require Tk::HList; |
| 4 |
|
| 5 |
$mw = MainWindow->new; |
| 6 |
my $hl = $mw->Scrolled('HList', -separator => '.', |
| 7 |
-width => 25, |
| 8 |
-drawbranch => 1, |
| 9 |
-selectmode => 'extended', |
| 10 |
-indent => 10, |
| 11 |
# -bg=>'green' |
| 12 |
); |
| 13 |
|
| 14 |
#my $hl = $mw->HList(-separator => '.', |
| 15 |
# -width => 25, |
| 16 |
# -drawbranch => 1, |
| 17 |
# -selectmode => 'extended', |
| 18 |
# -indent => 10, -bg=>'green'); |
| 19 |
|
| 20 |
print "reconfigure\n"; |
| 21 |
|
| 22 |
$hl->configure(-bg=>'red'); # none of these seem to work |
| 23 |
$hl->configure(-background=>'yellow'); |
| 24 |
|
| 25 |
$hl->configure( -command => \&PrintLine, -browsecmd => \&PrintBug); |
| 26 |
|
| 27 |
$hl->pack(-expand => 1, -fill => 'both'); |
| 28 |
|
| 29 |
@list = qw(one two three); |
| 30 |
|
| 31 |
foreach $item (@list) |
| 32 |
{ |
| 33 |
$hl->add($item,-itemtype => 'text', -text => $item, -data => {}); |
| 34 |
my $subitem; |
| 35 |
foreach $subitem (@list) |
| 36 |
{ |
| 37 |
$hl->addchild($item,-itemtype => 'text', -text => $subitem, -data => []); |
| 38 |
} |
| 39 |
} |
| 40 |
|
| 41 |
MainLoop; |
| 42 |
|
| 43 |
sub PrintLine { |
| 44 |
my $row = shift; |
| 45 |
my $data = $hl->info('data',$row); |
| 46 |
foreach ($hl,$row,$data) { |
| 47 |
print ref($_) ? "ref $_\n" : "string $_\n"; |
| 48 |
} |
| 49 |
print "\n"; |
| 50 |
} |
| 51 |
|
| 52 |
sub PrintBug { |
| 53 |
print "Browsecmd callback executed\n"; |
| 54 |
} |
| 55 |
|
| 56 |
__END__ |
| 57 |
|