1. getOpenFileName() Problem

Hello All,

The docs for getOpenFileName say:

  filename = getOpenFileName( 
                          theWindow,                  -- parent window\\ 
                          "",  -- no default name LINE 2\\ 
                          {"Text File", "*.TXT"})     -- text files\\ 
                           "All Files", "*.*" } )     -- everything else\\ 
                    

When I run this the folder where the file is located opens and only the text files show.

if I change to:

  filename = getOpenFileName( 
                          theWindow,                  -- parent window 
                          "C:\\",                         -- no default name LINE 2 
                          {"Text File", "*.TXT"})     -- text files 
                           "All Files", "*.*" } )     -- everything else 
                            
    The c: folder opens but all files are shown. None filtered.                        
 
Don Cole
new topic     » topic index » view message » categorize

2. Re: getOpenFileName() Problem

doncole2009 said...

... The c: folder opens but all files are shown. None filtered ...

The bug is in the buildDefaultOfn routine in w32file.ew

Find these lines in the routine

    -- Check to see if a directory name was supplied. 
    if   length(fName) > 0 
     and fName[length(fName)] = '\\'  then 
        fName &= "*.*" 
    end if 

and change them to

    -- Check to see if a directory name was supplied. 
    if   length(fName) > 0 
     and fName[length(fName)] = '\\'  then 
        if length(fName) = 3 and fName[2] = ':' then 
            fName &= ".\\." 
        else 
            fName &= "." 
        end if 
    end if 
new topic     » goto parent     » topic index » view message » categorize

3. Re: getOpenFileName() Problem

Thank you Derek,

You were right on the job again.

Don Cole

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu