Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem with getOpenFIle double-click in MS Windows

12 views
Skip to first unread message

mmcdo...@hotmail.com

unread,
Apr 17, 2009, 11:07:25 AM4/17/09
to
I am running Vista, Perl 5.10.0, Tk 804.028. When I run the script
below, if I click the 'Browse' button, then move the dialog so the
file I want is over the 'Create Output' button, then double-click the
file name, the 'Create Output' button is clicked after the dialog
closes.

Is this possibly a bug in getOpenFile or maybe the Windows dialog?

Mac

#!perl

#Run the program and click the 'Browse' button. Drag the file
selection
#dialog so that the 'Create Output' button is located behind the file
#name you want. Double-click the file name and see if the 'Create
#Output' button is clicked.

use Tk;
use Tk::LabEntry;

use vars qw/ $main /;

my $main = Tk::MainWindow->new(-title => 'Test Tk Error',);

my $selFnFrame = $main->Frame;
my $selectedFn = '';
my $selFn_Entry = $selFnFrame->LabEntry
(-label => 'Selected File:', -width => 40,
-labelPack => [qw/-side left -anchor w/],
-validate => focusout,
-textvariable => \$selectedFn)->pack(qw/-side left -anchor w
-expand 1 -fill x/);
$selFn_Entry->focus();
my $selFn_Button = $selFnFrame->Button(-text => 'Browse');
$selFn_Button->pack(qw/-side right -pady 15 -padx 10/);

my $goFrame = $main->Frame;
my $go_Button = $goFrame->Button(-text => 'Create Output',
-padx => 60, -pady => 60);
$go_Button->pack(qw/ -pady 10 -padx 10/);

my $rpCommand = sub {&GetFileNm('Selected File', \$selectedFn)};
$selFn_Button->configure(-command => $rpCommand);

$go_Button->configure(-command => \&Go_Button_command);

$selFnFrame->pack(qw/-side top -fill x/);
$goFrame->pack(qw/-side top -fill x/);

MainLoop;

sub GetFileNm {
my($msg,$filenm) = @_;

my $lastfile = (-f $$filenm) ? $$filenm : '';

my ( @file, $file );
my ( @parms );
push @parms,-defaultextension => '.csv',
-title => "Select $msg";
push @parms, -initialfile => $lastfile if $lastfile;
$file = $main->getOpenFile( @parms);
$$filenm = $file;
}

sub Go_Button_command {

$main->messageBox(
'-icon' => error, -type => Ok,
-title => 'Error',
-message => 'The Create Output Button was
pressed!');
}

mmcdo...@hotmail.com

unread,
Apr 17, 2009, 6:37:39 PM4/17/09
to
On Apr 17, 11:07 am, mmcdonal...@hotmail.com wrote:

Sorry, should have done a search first - this appears to be a very old
problem. Wonder why no solution yet?

Mac

smallpond

unread,
Apr 19, 2009, 12:36:39 PM4/19/09
to

It may be an old problem, but I don't see that anyone has
submitted a bug report for it. It seems to be a Windows-only
problem.

http://rt.cpan.org/Public/Dist/Display.html?Status=Active&Name=Tk

mmcdo...@hotmail.com

unread,
Apr 19, 2009, 2:57:46 PM4/19/09
to

I think that it might not be a Tk problem. I was able to reproduce it
using Win32::GUI->GetOpenFile, so it may be a bug in the native
Windows dialog.

0 new messages