conversecorollary has asked for the wisdom of the Perl Monks concerning the following question:

I have written Tkx application and everything works great except the tk_getOpenFile and tk_getSaveFile widgets. The only problem with them appears to be the ability to re-size them. This re-sizing issue appears to be a known issue that is over a year old. So, I started looking at alternatives and I thought about using the Win32::FileOp file dialog widgets. I was able to get them to work, but the problem I have is if I drag the dialog window across the main Tkx window I get the window trails left on the main Tkx window. The trails remain until I "close" the Win32::FileOp file dialog window. Right now my work around is to "iconify" the main Tkx window before displaying the Win32::FileOp file dialog window and then once the Win32::FileOp window is closed I then "deiconify" the main Tkx window. I was wondering if anyone knew how to eliminate the window trails when I drag the window? Or does anyone know when and if they fixed the tk_getOpenFile and tk_getSaveFile widgets? Or maybe some one has another Tkx related solution for these 2 widgets.

Thanks, gary

Replies are listed 'Best First'.
Re: Tkx and WIN32::FileOP
by BrowserUk (Patriarch) on May 27, 2011 at 21:27 UTC

    The problem is that the FileOp dialogs enter their own event loops, which means that Tk's event loop doesn't get serviced until the dialog completes. One way to prevent that would be to run the dialog in a thread and use DoOneEvent() in a loop until the dialog completes.

    Where you currently do:

    my $filename = OpenGialog( ... );

    You need to use something like this, though you'll need to look up the details yourself:

    use threads; use threads::shared; ... my $filename :shared; async { $filename = OpenDialog( ... ); }->detach; DoOneEvent( 1 ) until $filename; ## use $filename

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      Ah, I knew I was missing something here and it was some sort of interaction between the 2. Do you have any opinion about wxWidgets?
        Do you have any opinion about wxWidgets?

        No. I've never used them.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.