Re: use Tk::DirTree;
- From: smallpond <smallpond@xxxxxxxx>
- Date: Fri, 09 Nov 2007 14:40:07 -0800
On Nov 9, 3:00 pm, props666...@xxxxxxxxxxxxxx wrote:
I use use Tk::DirTree; to create an application where on the left side
appears a list of directories and when i click on each directory on
the right side of the window its content ( files ) comes up.
Until now i have managed to create the left side, the directory
listing using the Dirtree Tk module
use Tk::DirTree;
my $left_frm=$mw->Frame(
-relief=>'groove',
-borderwidth=>10,
-background=>'blue'
)->pack(-side=>'left');
#Folder listing
my $treelb = $left_frm->Scrolled('DirTree',
-selectmode => "single",
-selectbackground =>'black', ###Now do i need the -browsecmd
option or im mistaken to grab
-selectforeground =>'red', #the folder's name when
is double clicked ?
-width =>30,
-height =>80,
)->pack(-side=>'top',-anchor=>'w');
my $right_frm=$mw->Frame(
-relief=>'groove',
-borderwidth=>10,
-background=>'yellow'
)->pack(-side=>'right');
#File listing
my $display_lb = $right_frm->Listbox(
-selectmode => "single",
-selectbackground =>'black',
-selectforeground =>'red',
-background =>'red',
-width=>200,
-height=>80
)->pack(-side=>'top',-anchor=>'ne');
DirTree has up to 3 different callbacks
-browsecmd select a directory
-command for double-click on a directory
-dircmd is not what you want to use
Your -command sub could populate the right
side with the list of filenames from the
directory. The steps you need to do that
are:
delete the current contents of the right side
opendir, readdir, closedir - to get the list
sort the list to the order that you want
foreach - loop through entries, add each one
red on black? hmmm.
--S
.
- Follow-Ups:
- Re: use Tk::DirTree;
- From: props666999
- Re: use Tk::DirTree;
- References:
- use Tk::DirTree;
- From: props666999
- use Tk::DirTree;
- Prev by Date: Re: Positioning MainWindow
- Next by Date: Re: use Tk::DirTree;
- Previous by thread: use Tk::DirTree;
- Next by thread: Re: use Tk::DirTree;
- Index(es):
Relevant Pages
|