FF_OpenFileDialog - OFN_ALLOWMULTISELECT

Started by Art Araya, May 25, 2005, 06:26:12 PM

Previous topic - Next topic

Art Araya

I'm trying to use the FF_OpenFileDialog function to allow a user to select one or more files.  These are the flags that I am using:

%OFN_FILEMUSTEXIST OR %OFN_EXPLORER OR %OFN_ALLOWMULTISELECT

The problem is that OFN_ALLOWMULTISELECT flag does not work properly.  When I do not use this flag, I get the correct file that the user has chosen.  But when I use this flag I get back only the folder path and no files.

This is not a parsing issue.  All I am getting back from this function is a folder path.

The documentation states that I am supposed to get back "a $Nul (Chr$(0)) delimited list"

Any ideas of what I am doing wrong?

Art Araya

OK, figured this one out myself with the help of a post on the PB forum.  The function is working properly.  This is a parsing issue.  I believe that the code given in the FF help documentation is in error.  When I changed the parsing code to what I got off of the PB site, all of the files showed up.  

Here is the code I am using now to parse the sFileName variable that is populated by FF_OpenFileDialog:

[
    fCount = PARSECOUNT(sFileName, CHR$(0))
   

    IF fCount = 1 THEN                          '<- one file selected
       sFile = PARSE$(sFileName, CHR$(0), 1)    '<- Full path and file name
       'LISTBOX ADD hWnd, 20, sFile              '<- add to list, to see what we got
       
    ELSE                                        '<- Several files selected
       sPath = PARSE$(sFileName, CHR$(0), 1)    '<- Path first
       IF RIGHT$(sPath, 1) <> "\" THEN sPath = sPath & "\"
       FOR I = 2 TO fCount
          sFile = PARSE$(sFileName, CHR$(0), I) '<- File names
          'LISTBOX ADD hWnd, 20, sPath + sFile   '<- together for full path and file name
       NEXT
       
   END IF
]

taken from this post on the PB site:
http://www.powerbasic.com/support/forums/Forum7/HTML/000837.html

Roger Garstang

Yup, looks like there is some typos, and a logic compare missing on an IF...plus, I'm not sure what the sPath and starting searching at 2 is about, but you should be able to just parse by nul.  Never used the example and always made my own, so never noticed the problems with it.

TechSupport

Thanks Art, I have made note of this to fix for the next update.