Re: use Tk::DirTree;



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

.



Relevant Pages

  • Re: How can I copy and paste a directory listing into Excel
    ... All I want from the listing are the files’ ... Can I copy the "Directory Listing" and paste it into an Excel spreadsheet? ... download then install. ... choose "Open command window here". ...
    (microsoft.public.windowsxp.general)
  • {vim} preview in FTP listing
    ... I have problem with opening preview window for selected file in Ftp ... Then in listing I use "p" key on selected file, ...
    (comp.editors)
  • Re: [9fans] acme Put doesnt save
    ... listing frame, the tag line box is not filled. ... this is a bigger hint that you're doing something wrong. ... programs are allowed to take over a window. ... not make sense to write a directory through acme's interface. ...
    (comp.os.plan9)
  • Re: Windows XP Pro Networking Issue
    ... that opens on the first click but there's no message window. ... Explorer MS Home window open to see when a new comp comes on line. ... I saw BOTH computers in the listing. ...
    (microsoft.public.windowsxp.network_web)
  • Re: Pop Up
    ... then click the Control Panel icon. ... The> Administrative Tools window appears. ... Scroll down the list in the> right windowpane and double-click the Messenger listing. ...
    (microsoft.public.security)