Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello again, Last question I hope, I have the following code to retrieve a file, but I'm interested in retriveing more the one file. Any suggestions?
#!/c:/perl use Win32; use Win32::Process; use Tk; use Tk::HList; use Tk::Notebook; use vars qw($int $entry); &init_ui(); MainLoop; sub init_ui { my $mw = MainWindow->new; $mw->title("File Converter"); # menu bar (top) my $menu = $mw->Frame( -borderwidth => '2', -relief => 'groove' )->pack(-side => 'top', -anchor => 'n', -expand => 1, -fill => + 'x'); $menu->Menubutton( -text => "File", -menuitems => [ ['command' => "Open", -command => sub { fileDi +alog()}] ] )->pack(-side =>'left'); sub filebox { my $f = $mw->Frame; my $but = $f->Button(-text => "Browse ...", -command => sub { fileDialog()}); $but->pack(-side => 'left'); $f->pack(-fill => 'x', -padx => '1c', -pady => 3); } sub fileDialog { my $types; my $file; @types = (["MP3 Files", '.mp3'], ["All files", '*'] ); $file = $mw->getOpenFile(-filetypes => \@types); print "FILE: $file\n"; } }
Thanks again, you guys have been a great help today!

Replies are listed 'Best First'.
Re: Get Multiple files with TK
by smackdab (Pilgrim) on Mar 30, 2002 at 02:43 UTC
    I think you need to set a flag: OFN_ALLOWMULTISELECT It is part of the OPENFILENAME structure (in C) that the GetOpenFileName() function calls. Don't know where to change it in Tk though...