blackadder has asked for the wisdom of the Perl Monks concerning the following question:
require 5.006; use strict; use Tk 800.005; use Tk::TList; use Tk::Frame; use Tk::DirTree; use Tk::Scrollbar; use Tk::Adjuster; use warnings 'all'; use vars qw/%tk %dr/; $tk{mw} = MainWindow->new (-background=>'white'); $tk{mw}->geometry('700x500'); $tk{top_frame} = $tk{mw}->Frame; $tk{left_frame} = $tk{mw}->Frame; $tk{adjuster} = $tk{mw}-> Adjuster(-widget=>$tk{left_frame},-side=>'le +ft'); $dr{PATH}='c:/'; $tk{entry_box}=$tk{top_frame}->Entry(-textvariable=>\ $dr{PATH}); $tk{dir_tree}= $tk{left_frame}->Scrolled('DirTree', -height=>'0', -wid +th=>'0',-scrollbars=>'e',); $tk{entry_box}->bind('<Key-Return>', sub {OnNewPath();}); $tk{top_frame}->pack(qw/-side top -fill x/); $tk{left_frame}->pack(qw/-side left -fill y/); $tk{adjuster}->pack(qw/-side left -fill y/); $tk{entry_box}->pack(qw/-side top -fill both -expand 1/); $tk{dir_tree}->pack(qw/-side left -fill both -expand 1/); MainLoop; exit(0); sub OnNewPath{ $tk{dir_tree}->delete('0.1',''); #this little tinker doesn't work $tk{dir_tree}->chdir( $dr{PATH} );}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tk::DirTree question
by Courage (Parson) on Aug 02, 2002 at 11:56 UTC | |
by blackadder (Hermit) on Aug 02, 2002 at 12:21 UTC |