Skip Menu |

This queue is for tickets about the Tk-JFileDialog CPAN distribution.

Report information
The Basics
Id: 125552
Status: resolved
Priority: 0/
Queue: Tk-JFileDialog

People
Owner: turnerjw784 [...] yahoo.com
Requestors: tlhackque [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 2.0



Subject: Directory default not intuitive.
Date: Mon, 11 Jun 2018 08:42:27 -0400
To: bug-Tk-JFileDialog [...] rt.cpan.org
From: tlhackque <tlhackque [...] yahoo.com>
Tk::JFileDialog::VERSION == 1.62 Again on Windows. The dialog is very confusing and inconsistent with respect to the path. My current directory is C:\Users\tlhackque\project. I have a filter '*.jpg" specified. There are no .jpg files. Chooser's directory pane correctly shows: / . .. foobar baz And nothing in Files. (foobar and baz are directories) I enter "foo" in the filename. I enter nothing in the path, which is blank. I click OK. The dialog returns "C:/foo" I expect it to return either "foo" or "C:/users/tlhackque/project/foo" If I click "CWD", it populates path and returns what I expect by default. The issue is that the chooser shows me something reasonable, but that's not what the dialog returns. If it shows me my CWD in the directory pane, (which is reasonable), the returned path should include it. If I select another path (with the mouse or via the form's entry box), the directory chooser should be updated. Bottom line: The chooser display, the path entry box, and the returned string should always be in sync. But they are not. I'd prefer that the dialog always return an absolute path, but a relative path is OK IF it's really relative. C:/anyting isn't relative... Divots aside, this is a nice module. Hope you can fix them. Thanks. The actual code: my $fs = $top->JFileDialog ( -title => 'Save as', -Create => 1, -DisableFPat => 1, -SelectMode => 'single', -HistFile => File::Spec->catfile( $home, 'imagemgr.file.history' ), -HistDeleteOk => 1, -PathFile => File::Spec->catfile( $home, 'imagemgr.path.history' ), -SelDir => 0, -FPat => '*.jpg', -QuickSelect => 0, ); my $saveto = $fs->Show(); if( !defined $saveto ) { return; } print( "returned '$saveto'\n"); # Prints: returned 'C:/foo'
Not a show-stopper, but FYI: I had some trouble with your example code ("$home") isn't defined. Here's what I actually ended up with: ============ CODE ============ #!/usr/bin/perl use Tk; use Tk::JFileDialog; use File::Spec; my $top = MainWindow->new; my $bummer = ($^O =~ /MSWin/) ? 1 : 0; my $home = $bummer ? ($ENV{'HOMEDRIVE'} . $ENV{'HOMEPATH'}) : $ENV{'HOME'}; my $fs = $top->JFileDialog ( -title => 'Save as', -Create => 1, -DisableFPat => 1, -SelectMode => 'single', -HistDeleteOk => 1, -SelDir => 0, -FPat => '*.jpg', -QuickSelect => 0, -HistFile => File::Spec->catfile( $home, 'imagemgr.file.history' ), -PathFile => File::Spec->catfile( $home, 'imagemgr.path.history' ), ); my $saveto = $fs->Show(); print "-???- Windows=$bummer: File History =".File::Spec->catfile( $home, 'imagemgr.file.history' )."=\n"; if( !defined $saveto ) { die "User cancelled?!\n"; } print( "returned '$saveto'\n"); ========= END CODE ================= Regards, Jim On Mon Jun 11 08:42:49 2018, tlhackque wrote: Show quoted text
> Tk::JFileDialog::VERSION == 1.62 > > Again on Windows. > > The dialog is very confusing and inconsistent with respect to > the path. > > My current directory is C:\Users\tlhackque\project. > > I have a filter '*.jpg" specified. There are no .jpg files. > > Chooser's directory pane correctly shows: > > / > . > .. > foobar > baz > > And nothing in Files. (foobar and baz are directories) > > I enter "foo" in the filename. I enter nothing in the path, which is blank. > > I click OK. > > The dialog returns "C:/foo" > > I expect it to return either "foo" or "C:/users/tlhackque/project/foo" > > If I click "CWD", it populates path and returns what I expect by default. > > The issue is that the chooser shows me something reasonable, but that's > not what the dialog returns. > > If it shows me my CWD in the directory pane, (which is reasonable), the > returned path should include it. > > If I select another path (with the mouse or via the form's entry box), > the directory chooser should be updated. > > Bottom line: The chooser display, the path entry box, and the returned > string should always be in sync. But they are not. > > I'd prefer that the dialog always return an absolute path, but a > relative path is OK IF it's really relative. C:/anyting isn't relative... > > Divots aside, this is a nice module. Hope you can fix them. > > Thanks. > > The actual code: > > my $fs = $top->JFileDialog ( -title => 'Save as', > -Create => 1, -DisableFPat => 1, > -SelectMode => 'single', > -HistFile => > File::Spec->catfile( $home, > 'imagemgr.file.history' ), > -HistDeleteOk => 1, > -PathFile => > File::Spec->catfile( $home, > 'imagemgr.path.history' ), > -SelDir => 0, -FPat => '*.jpg', > -QuickSelect => 0, > ); > > my $saveto = $fs->Show(); > if( !defined $saveto ) { > return; > } > print( "returned '$saveto'\n"); > # Prints: > returned 'C:/foo'
Fixed in v2.0, just released. Jim. On Mon Jun 11 08:42:49 2018, tlhackque wrote: Show quoted text
> Tk::JFileDialog::VERSION == 1.62 > > Again on Windows. > > The dialog is very confusing and inconsistent with respect to > the path. > > My current directory is C:\Users\tlhackque\project. > > I have a filter '*.jpg" specified. There are no .jpg files. > > Chooser's directory pane correctly shows: > > / > . > .. > foobar > baz > > And nothing in Files. (foobar and baz are directories) > > I enter "foo" in the filename. I enter nothing in the path, which is blank. > > I click OK. > > The dialog returns "C:/foo" > > I expect it to return either "foo" or "C:/users/tlhackque/project/foo" > > If I click "CWD", it populates path and returns what I expect by default. > > The issue is that the chooser shows me something reasonable, but that's > not what the dialog returns. > > If it shows me my CWD in the directory pane, (which is reasonable), the > returned path should include it. > > If I select another path (with the mouse or via the form's entry box), > the directory chooser should be updated. > > Bottom line: The chooser display, the path entry box, and the returned > string should always be in sync. But they are not. > > I'd prefer that the dialog always return an absolute path, but a > relative path is OK IF it's really relative. C:/anyting isn't relative... > > Divots aside, this is a nice module. Hope you can fix them. > > Thanks. > > The actual code: > > my $fs = $top->JFileDialog ( -title => 'Save as', > -Create => 1, -DisableFPat => 1, > -SelectMode => 'single', > -HistFile => > File::Spec->catfile( $home, > 'imagemgr.file.history' ), > -HistDeleteOk => 1, > -PathFile => > File::Spec->catfile( $home, > 'imagemgr.path.history' ), > -SelDir => 0, -FPat => '*.jpg', > -QuickSelect => 0, > ); > > my $saveto = $fs->Show(); > if( !defined $saveto ) { > return; > } > print( "returned '$saveto'\n"); > # Prints: > returned 'C:/foo'