GetOpenFile/getSaveFile initialization problem? 
Author Message
 GetOpenFile/getSaveFile initialization problem?

Hi,
A couple of days ago I complained about getOpenFile always returning an
empty string. I also asserted that the "widget" demo "worked".

Regrettably I was wrong on both assertions, on my system, MacOSX 10.2.1,
Perl 5.8.0, Tk 800.024, the failure only occurs on the first invocation of
either call. The following code will return an empty string on the first
iteration and the correct string on subsequent iterations.

#!/usr/local/bin/perl
use Tk;

$mw = new MainWindow;

 my $myfile="Whatever";
 my $types;

for $i  (1,2,3) {
# Get the CSV file name

 $myfile = $mw->getOpenFile(-title=>"FooBar");
 print "...$myfile...\n";

Quote:
}

MainLoop;

It smells like there is some kind of initialization problem in the Fbox
code.

Am I the only person with this problem?

Help!

Jerry



Sun, 27 Mar 2005 21:28:38 GMT  
 GetOpenFile/getSaveFile initialization problem?

Quote:

> Hi,
> A couple of days ago I complained about getOpenFile always returning an
> empty string. I also asserted that the "widget" demo "worked".

> Regrettably I was wrong on both assertions, on my system, MacOSX 10.2.1,
> Perl 5.8.0, Tk 800.024, the failure only occurs on the first invocation of
> either call. The following code will return an empty string on the first
> iteration and the correct string on subsequent iterations.

> #!/usr/local/bin/perl
> use Tk;

> $mw = new MainWindow;

>  my $myfile="Whatever";
>  my $types;

> for $i  (1,2,3) {
> # Get the CSV file name

>  $myfile = $mw->getOpenFile(-title=>"FooBar");
>  print "...$myfile...\n";
> }
> MainLoop;

> It smells like there is some kind of initialization problem in the Fbox
> code.

> Am I the only person with this problem?

Can you do some debugging? In Tk/FBox.pm, put the line


as the first line of the TclFileJoin function and

        warn $path;

as the line before the last line ($path;) in TclFileJoin and report
the results.

Regards,
        Slaven

--

    tktimex - project time manager
    http://sourceforge.net/projects/ptktools/



Sun, 27 Mar 2005 23:16:12 GMT  
 GetOpenFile/getSaveFile initialization problem?


Quote:

>> Hi,
>> A couple of days ago I complained about getOpenFile always returning an
>> empty string. I also asserted that the "widget" demo "worked".

>> Regrettably I was wrong on both assertions, on my system, MacOSX 10.2.1,
>> Perl 5.8.0, Tk 800.024, the failure only occurs on the first invocation of
>> either call. The following code will return an empty string on the first
>> iteration and the correct string on subsequent iterations.

>> #!/usr/local/bin/perl
>> use Tk;

>> $mw = new MainWindow;

>>  my $myfile="Whatever";
>>  my $types;

>> for $i  (1,2,3) {
>> # Get the CSV file name

>>  $myfile = $mw->getOpenFile(-title=>"FooBar");
>>  print "...$myfile...\n";
>> }
>> MainLoop;

>> It smells like there is some kind of initialization problem in the Fbox
>> code.

>> Am I the only person with this problem?

> Can you do some debugging? In Tk/FBox.pm, put the line


> as the first line of the TclFileJoin function and

> warn $path;

> as the line before the last line ($path;) in TclFileJoin and report
> the results.

> Regards,
> Slaven

Slaven,

Output of the warn statements has the correct file name each iteration
The first returned value is munged, the other two are correct.

[macjerry:~]$ filetest.pl
 / at /usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 654.
/ at /usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 680.
/ Users at /usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 654.
/Users at /usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 680.
/Users jerry at /usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line
654.
/Users/jerry at /usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line
680.
/Users/jerry BankOneTab at
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 654.
/Users/jerry/BankOneTab at
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 680.
/Users/jerry BankOneTab at
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 654.
/Users/jerry/BankOneTab at
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 680.
/Users/jerry BankOneTab at
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 654.
/Users/jerry/BankOneTab at
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 680.
/Users/jerry BankOneTab at
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 654.
/Users/jerry/BankOneTab at
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 680.
......  <-- this is not the right result !!
 / at /usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 654.
/ at /usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 680.
/ Users at /usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 654.
/Users at /usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 680.
/Users jerry at /usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line
654.
/Users/jerry at /usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line
680.
/Users/jerry CheckingData.txt at
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 654.
/Users/jerry/CheckingData.txt at
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 680.
/Users/jerry CheckingData.txt at
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 654.
/Users/jerry/CheckingData.txt at
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 680.
/Users/jerry CheckingData.txt at
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 654.
/Users/jerry/CheckingData.txt at
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 680.
/Users/jerry CheckingData.txt at
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 654.
/Users/jerry/CheckingData.txt at
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 680.
.../Users/jerry/CheckingData.txt...  <- this is correct
 / at /usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 654.
/ at /usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 680.
/ Users at /usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 654.
/Users at /usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 680.
/Users jerry at /usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line
654.
/Users/jerry at /usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line
680.
/Users/jerry BankOneFixed at
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 654.
/Users/jerry/BankOneFixed at
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 680.
/Users/jerry BankOneFixed at
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 654.
/Users/jerry/BankOneFixed at
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 680.
/Users/jerry BankOneFixed at
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 654.
/Users/jerry/BankOneFixed at
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 680.
/Users/jerry BankOneFixed at
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 654.
/Users/jerry/BankOneFixed at
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 680.
.../Users/jerry/BankOneFixed...  <- this is correct
[macjerry:~]$



Sun, 27 Mar 2005 23:43:51 GMT  
 GetOpenFile/getSaveFile initialization problem?

Quote:




> >> Hi,
> >> A couple of days ago I complained about getOpenFile always returning an
> >> empty string. I also asserted that the "widget" demo "worked".

> >> Regrettably I was wrong on both assertions, on my system, MacOSX 10.2.1,
> >> Perl 5.8.0, Tk 800.024, the failure only occurs on the first invocation of
> >> either call. The following code will return an empty string on the first
> >> iteration and the correct string on subsequent iterations.

> >> #!/usr/local/bin/perl
> >> use Tk;

> >> $mw = new MainWindow;

> >>  my $myfile="Whatever";
> >>  my $types;

> >> for $i  (1,2,3) {
> >> # Get the CSV file name

> >>  $myfile = $mw->getOpenFile(-title=>"FooBar");
> >>  print "...$myfile...\n";
> >> }
> >> MainLoop;

> >> It smells like there is some kind of initialization problem in the Fbox
> >> code.

> >> Am I the only person with this problem?

> > Can you do some debugging? In Tk/FBox.pm, put the line


> > as the first line of the TclFileJoin function and

> > warn $path;

> > as the line before the last line ($path;) in TclFileJoin and report
> > the results.

> > Regards,
> > Slaven
> Slaven,

> Output of the warn statements has the correct file name each iteration
> The first returned value is munged, the other two are correct.

TclFileJoin seems to be correct... can you remove the warnings and add
new ones in the "Done" subroutine:


        warn "$w->{'selectFilePath'} | $selectFilePath"; # as last line

Regards,
        Slaven

--

Lost in your Tk widget tree? Try
        http://user.cs.tu-berlin.de/~eserte/src/perl/Tk-WidgetDump/



Mon, 28 Mar 2005 03:45:25 GMT  
 GetOpenFile/getSaveFile initialization problem?

Quote:

> Hi,
> A couple of days ago I complained about getOpenFile always returning an
> empty string. I also asserted that the "widget" demo "worked".
> Regrettably I was wrong on both assertions, on my system, MacOSX 10.2.1,
> Perl 5.8.0, Tk 800.024, the failure only occurs on the first invocation of
> either call. The following code will return an empty string on the first
> iteration and the correct string on subsequent iterations.
> #!/usr/local/bin/perl
> use Tk;
> $mw = new MainWindow;
>  my $myfile="Whatever";
>  my $types;
> for $i  (1,2,3) {
> # Get the CSV file name

>  $myfile = $mw->getOpenFile(-title=>"FooBar");
>  print "...$myfile...\n";
> }
> MainLoop;
> It smells like there is some kind of initialization problem in the Fbox
> code.
> Am I the only person with this problem?

Well, I have the same OS/Tk/Perl versions and the above program works
for me.

Steve

'other perl hacker';$z='createText';$c=$m->Canvas(-wi,$_[1],-he,25)->grid;$c->$
En'.
'ter>',sub{$y=int(rand($m->screenheight));$m->geometry("+$y+$y")});MainLoop;



Mon, 28 Mar 2005 04:36:46 GMT  
 GetOpenFile/getSaveFile initialization problem?


Quote:




>>>> Hi,
>>>> A couple of days ago I complained about getOpenFile always returning an
>>>> empty string. I also asserted that the "widget" demo "worked".

>>>> Regrettably I was wrong on both assertions, on my system, MacOSX 10.2.1,
>>>> Perl 5.8.0, Tk 800.024, the failure only occurs on the first invocation of
>>>> either call. The following code will return an empty string on the first
>>>> iteration and the correct string on subsequent iterations.

>>>> #!/usr/local/bin/perl
>>>> use Tk;

>>>> $mw = new MainWindow;

>>>>  my $myfile="Whatever";
>>>>  my $types;

>>>> for $i  (1,2,3) {
>>>> # Get the CSV file name

>>>>  $myfile = $mw->getOpenFile(-title=>"FooBar");
>>>>  print "...$myfile...\n";
>>>> }
>>>> MainLoop;

>>>> It smells like there is some kind of initialization problem in the Fbox
>>>> code.

>>>> Am I the only person with this problem?

>>> Can you do some debugging? In Tk/FBox.pm, put the line


>>> as the first line of the TclFileJoin function and

>>> warn $path;

>>> as the line before the last line ($path;) in TclFileJoin and report
>>> the results.

>>> Regards,
>>> Slaven
>> Slaven,

>> Output of the warn statements has the correct file name each iteration
>> The first returned value is munged, the other two are correct.

> TclFileJoin seems to be correct... can you remove the warnings and add
> new ones in the "Done" subroutine:


> warn "$w->{'selectFilePath'} | $selectFilePath"; # as last line

> Regards,
> Slaven

Here is the output of the above suggestion, looks like $selectFilePath
Is always set...
Tk::FBox=HASH(0x42d6fc) at
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 769.
 | /Users/jerry/BankOneTab at  <-- OK
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 785.
...... <- Bad answer!
Tk::FBox=HASH(0x42d6fc) at
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 769.
 | /Users/jerry/BankOneFixed at  <-- OK
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 785.
.../Users/jerry/BankOneFixed...   <--OK
Tk::FBox=HASH(0x42d6fc) at
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 769.
 | /Users/jerry/BankOneAlt at  <-- OK
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Tk/FBox.pm line 785.
.../Users/jerry/BankOneAlt... <-- OK
[macjerry:~]$


Mon, 28 Mar 2005 06:23:38 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Make FileSelect works with getOpenFile/getSaveFile (typo corrected)

2. Make FileSelect works with getOpenFile/getSaveFile

3. Can't set -initialdir for getOpenFile or getSaveFile in Linux, Solaris, or Windows

4. problem with getSaveFile..."fBox" appears

5. getSavefile problem, another report

6. getSavefile problem

7. getSaveFile problem

8. getSaveFile problem

9. A subtle problem with setting up Perl debug initialization code

10. Problem with hash initialization using list

11. initialization problem and segmentation fault

12. getOpenFIle problem

 

 
Powered by phpBB® Forum Software