in reply to Doubt with getOpenFile
It is working fine for me on Linux, but I think the '-initialdir' option should be '.' or a dir name.
I made a complete working example so other monks can test more easily :)
use strict; use warnings; use Tk; my $mw = MainWindow->new; $mw->Button( -text => 'Select file', -width => 10, -command => \&select_file, )->pack(-side => 'left', -padx => 2); MainLoop; sub select_file { my @types = (["Perl files",'.pl'], ["Text files",'.txt'], ["All fi +les", '*']); my $xlsFileName = $mw->getOpenFile( -filetypes => \@types, -title =>'file to read', -initialdir => '.', ); # $mw->Unbusy; return unless $xlsFileName; print "Selected File: $xlsFileName\n"; # $mw -> update; }
Regards, Stefan
Update: Reintroduced the "return unless" line
|
|---|