tkFileDialog.... help

Dan Kuchler kuchler at ajubasolutions.com
Fri Aug 25 02:27:31 EDT 2000


Kevin Cazabon wrote:
> 
> Thanks Martin;
> 
> It works ok, but the problem I have is that you can't specify multiple file
> types to filter.  I guess it's better than only being able to select
> individual files, but it's not ideally what I was looking for.
> 
> In the meantime though, it's working.  I'm going to try to see if maybe
> Mark's win32 stuff can be hacked to do it through the windows API.
> 

The current Tk sources support multiple selection.

The code that makes it work was added to:

tk/win/tkWinDialog.c

In GetFileNameW there is some code to handle arguments
which sets multi to 1 or 0.

Then there are the lines:

    if (multi != 0) {
        ofn.Flags |= OFN_ALLOWMULTISELECT;
    }

when the flags are being setup.

Then after the dialog is closed there is a test:

    if (winCode != 0) {
        if (ofn.Flags & OFN_ALLOWMULTISELECT) {
            /*
             * The result in custData->szFile contains many items,
             * separated with null characters.  It is terminated with
             * two nulls in a row.  The first element is the directory
             * path.
             */

and if multi-select is set, then it builds up a list of all of the
files that were selected.

If you look at the source code in CVS (and maybe even the source
for 8.4a1) you can see how this works.

The source is available at http://dev.scriptics.com/

--Dan



More information about the Python-list mailing list