| [reply] |
They system I am writting on is on a isolated network I will see what I can do get a sample over.
| [reply] |
| [reply] [d/l] |
| [reply] [d/l] |
i think all you need is $t->close('/') before the mainloop
#!/usr/bin/perl
use strict;
use Tk;
use Tk::Tree;
my $mw = tkinit;
my $t = $mw->Scrolled(
'Tree',
-separator => '/',
-scrollbars => 'osoe',
)->pack;
foreach (qw(/ /a /b /c /a/s /a/s/d /a/s/d/f /b/n /b/n/m)) {
my @text = reverse split( /\//, $_ );
$t->add( $_, -text => @text[0] );
}
$t->autosetmode;
foreach ( $t->info( 'children', '/' ) ) {
$t->close($_);
}
$mw->Button(-text=>'Close nodes',
-command => sub{ closeTree($t, '/a') }
)->pack();
$t->close('/');
MainLoop;
sub closeTree {
my $tree = shift;
my ($entryPath, $hideChildren) = @_;
my @children = $tree->info (children => $entryPath);
return if ! @children;
for (@children) {
closeTree ($tree, $_, 1);
$tree->hide ('entry' => $_) if $hideChildren;
}
$tree->setmode ($entryPath, 'open') if length $entryPath;
}
| [reply] [d/l] |