gri6507 has asked for the wisdom of the Perl Monks concerning the following question:
Please refer to the code below for an example. I'm running SunOS 5.8 Generic_108528-13 sun4u sparc SUNW,Sun-Blade-100, where perl is ActiveState perl v5.6.1 built for sun4-solaris-thread-multi. Running the code below, the first time I click the button, I get a FileOpen dialog with the initial directory of "/", instead of "/tmp" as requested. The second time I click the button, I get a FileOpen dialog with the initial directory of "/tmp", but, the "Directory" box incorrectly says "/".
I saw some references to this problem at this node, but there was no solution posted. I'd like to repost the same question. Is there something wrong with what I'm doing? Is there a bug in getOpenFile()? Is there another way to achieve the same result?
use Tk; use strict; my $mw = MainWindow->new(); my $b = $mw->Button(-text=>"Click me",-command=>sub{foo()})->pack(); MainLoop; sub foo { my $fname = $mw->getOpenFile(-initialdir=>"/tmp",-title=>"trying"); return unless defined ($fname); print "You've selected $fname\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tk getOpenFile initialdir problem
by eserte (Deacon) on Jun 02, 2004 at 14:23 UTC | |
by gri6507 (Deacon) on Jun 02, 2004 at 14:38 UTC | |
by eserte (Deacon) on Jun 02, 2004 at 15:10 UTC |