As a test, I rewrote my gui test program (see later post) to use Tkx. Surprisingly easy, though I can't find a scrolled text gadget which is a worry. The changed subroutines only below:
... use Tkx; ... sub init_gui { $win = Tkx::widget->new('.'); $win->g_wm_geometry('+500+200'); $win->g_wm_title('Tkx wrapper'); $win->g_wm_minsize(400, 200); $win->g_wm_protocol('WM_DELETE_WINDOW', sub { exit; }); $win->g_wm_resizable(0, 0); my $f1 = $win->new_frame(); my $f2 = $win->new_frame(); $t1 = $f1->new_text(); $t1->g_pack(-anchor=>'e', -fill=>'both'); my $b1 = $f2->new_button(-text=>'Browse...', -width=>10, -command=>\ +&select); $b1->g_pack(-anchor=>'e', -fill=>'both'); $f1->g_grid(-row=>0, -column=>0, -padx=>8, -pady=>4, -sticky=>'n'); $f2->g_grid(-row=>1, -column=>0, -padx=>8, -pady=>4, -sticky=>'n'); return; } ... sub select { my $filename = Tkx::tk___getOpenFile( -defaultextension => '', -initialdir => $path, -title => 'Select file', ); if ($filename) { test_file($filename); } return; } __END__

Result? No improvement. The sub "load" still finds all the files which test and open ok in sub "test_file". Files with extended chars in the path opened under Windows using the sub "select" linked to the button give a "Does not exist" on the -d test of sub "test_file". They open fine under Linux (and presumably OS-X too if I wasn't too lazy to pull the Mac out).

Probably shouldn't be a surprise as I suspect Tk::FBox->getOpenFile and Tkx::tk___getOpenFile are thin wrappers over Tcl which calls the native file dialog which is where I suspect the real encoding problem lies.

So, Tkx is NO CURE for the dreaded extended chars in the file path problem (and I've decided not to like Tkx ;-). Converting would mean more complexity to manage scroll bars manually and probably other things. Only positive is I'd be freed from AS perl 5.8.x which Tk support ties me to.

Update: I've found CPAN Tkx::Scrolled which seems to work fine installed with ActiveState cpan (no ppm). Some differences between Tk and Tkx re scrolling programatically, but I'm liking Tkx a bit better.


In reply to Re^2: Tk causes problems with file paths containing non-Latin-1 chars by ron7
in thread Tk causes problems with file paths containing non-Latin-1 chars by ron7

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.