# HList, a hierarchial listbox widget.
use vars qw
/$TOP $FILEIMG $FOLDIMG/;
-text
=> 'HList - A hierarchial listbox widget.',
-geometry_manager
=> 'grid',
my $h = $TOP->Scrolled(qw\HList
-separator
/ -selectmode extended
-width
30
-height
20 -indent
35 -scrollbars se
)->grid(qw
/-sticky nsew/);
$h->configure(-command
=> sub {
print "Double click $_[0], size=", $h->info('data', $_[0]) ,".\n";
$FILEIMG = $TOP->Bitmap(-file
=> Tk
->findINC('file.xbm'));
$FOLDIMG = $TOP->Bitmap(-file
=> Tk
->findINC('folder.xbm'));
my $root = Tk
->findINC('demos');
my $b = $TOP->Button(-text
=> 'Select All', -command
=> [\
&select_all
, $h]);
my @list = $h->infoChildren(@_);
$h->selectionSet($list[0],$list[-1]);
my($entry_path, $text, $h) = @_;
my(@dirent) = grep ! /^\.\.?$/, sort(readdir H
);
$h->add($entry_path, -text
=> $text, -image
=> $FOLDIMG, -data
=> 'DIR');
while ($_ = shift @dirent) {
my $file = "$entry_path/$_";
$h->add($file, -text
=> $_, -image
=> $FILEIMG, -data
=> $size);