my $area = $mw->Entry(-background => "white", -foreground => "black", -width => 51)->place(-x=>100, -y=>$ystart + 60); $area->insert('end', "$workarea"); sub dirtree_sub { if ($area->get() ne "") { $CWD = $area->get(); } else { $CWD = Cwd::cwd(); }; my $dirtree_frame = $mw->Toplevel; $dirtree_frame->title("Select work area"); my $DIR_TREE = $dirtree_frame->Scrolled('DirTree', -scrollbars => "osoe", -width => 50, -height => 25, -exportselection => 1, -browsecmd => sub {$CWD = shift}, -command => sub {\&show_cwd(); $dirtree_frame->destroy})->pack(-fill => "both", -expand => 1); $DIR_TREE->chdir($CWD); my $button_frame = $dirtree_frame->Frame()->pack(-side => "bottom"); $button_frame->Button(-text => "Ok", -command => sub {\&show_cwd(); $dirtree_frame->destroy})->pack(-side => "left"); $button_frame->Button(-text => "Exit", -command => [$dirtree_frame=>'destroy'])->pack(-side => "left"); }; sub show_cwd { $area->delete('0.0', 'end'); $area->insert('end', $CWD); }