1. win32lib: getSaveFileName

Is there a way to know, if several file file filters are used in
getSaveFileName(), to know which one the user selects? What I'm thinking of
is:

FILETYPES=("Euphoria DOS,*.ex",
           "Euphoria WIN,*.exw",
           "Text Files, *.txt",
           "All Files, *.*"}

Thanks,
Judith Evans

new topic     » topic index » view message » categorize

2. Re: win32lib: getSaveFileName

Judith,

This may be silly, but it should (?) work if no one has any thing better to
suggest:

strip the extent off the returned filename, & if it's ".ex", then user
selected "Euphoria Dos"; if it's ".exw", then user selected "Euphoria Win";
if it's ".txt", well, I'm sure you got the idea :)

Dan

----- Original Message -----
From: "Judith Evans" <camping at FLASH.NET>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Thursday, October 05, 2000 2:28 AM
Subject: win32lib: getSaveFileName


> Is there a way to know, if several file file filters are used in
> getSaveFileName(), to know which one the user selects? What I'm thinking
of
> is:
>
> FILETYPES=("Euphoria DOS,*.ex",
>            "Euphoria WIN,*.exw",
>            "Text Files, *.txt",
>            "All Files, *.*"}
>
> Thanks,
> Judith Evans

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

3. Re: win32lib: getSaveFileName

Dan,

Not silly at all. But what I was trying to accomplish is the situation where
the user DOESN't enter the extention. Cause then I have no idea what to put.

thanks anyway,
Judith




On Thu, 5 Oct 2000 05:39:04 -0700, Dan B Moyer <DANMOYER at PRODIGY.NET> wrote:

>Judith,
>
>This may be silly, but it should (?) work if no one has any thing better to
>suggest:
>
>strip the extent off the returned filename, & if it's ".ex", then user
>selected "Euphoria Dos"; if it's ".exw", then user selected "Euphoria Win";
>if it's ".txt", well, I'm sure you got the idea :)
>
>Dan
>
>----- Original Message -----
>From: "Judith Evans" <camping at FLASH.NET>
>To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
>Sent: Thursday, October 05, 2000 2:28 AM
>Subject: win32lib: getSaveFileName
>
>
>> Is there a way to know, if several file file filters are used in
>> getSaveFileName(), to know which one the user selects? What I'm thinking
>of
>> is:
>>
>> FILETYPES=("Euphoria DOS,*.ex",
>>            "Euphoria WIN,*.exw",
>>            "Text Files, *.txt",
>>            "All Files, *.*"}
>>
>> Thanks,
>> Judith Evans

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

4. Re: win32lib: getSaveFileName

On Thu, 5 Oct 2000 05:28:25 -0400, Judith Evans wrote:

>Is there a way to know, if several file file filters are used in
>getSaveFileName(), to know which one the user selects? What I'm thinking of
>is:
>
>FILETYPES=("Euphoria DOS,*.ex",
>           "Euphoria WIN,*.exw",
>           "Text Files, *.txt",
>           "All Files, *.*"}
>
>Thanks,
>Judith Evans

No problem, if you don't mind modifying your Win32Lib...

Modify getSaveFileName as follows:
--------------------------------------------------------------
global function getSaveFileName( integer id, sequence fName, sequence
filters )
    integer fIndex
    atom ofn

    -- build the structure
    ofn = buildDefaultOfn( id, fName, filters, or_all( {
        OFN_OVERWRITEPROMPT } ) )   -- warn if exists

    -- call the routine
    if c_func(xGetSaveFileName, {ofn}) then
        -- get the name
        fName = fetch( ofn, ofnFile )
        -- ADDED: get filter index
        fIndex = fetch( ofn, ofnFilterIndex )
    else
        -- cancelled
        fName = ""
    end if

    -- release the structure and strings
    free( ofn )
    free_strings()

    -- return result
    -- ADDED: return a sequence that includes the filter index
    return { fName, fIndex }

end function
--------------------------------------------------------------

and a demo:
--------------------------------------------------------------
include Win32Lib.ew

constant
  Win = create( Window, "save demo", 0, 20, 20, 200, 200, 0 ),
  FILETYPES={"Euphoria DOS","*.ex",
             "Euphoria WIN","*.exw",
             "Text Files", "*.txt",
             "All Files", "*.*"}

sequence result
integer index

result = getSaveFileName( Win, "", FILETYPES )
index = 2*(result[2]-1)+1

puts(1, "File name: " & result[1] & "\n" )

puts(1, "File type: " & FILETYPES[index] &
        " -> " & FILETYPES[index+1] )

WinMain(Win,Normal)
--------------------------------------------------------------

-- Brian

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

5. Re: win32lib: getSaveFileName

>
>No problem, if you don't mind modifying your Win32Lib...

>-- Brian

Thanks a million, Bryan! I'll give it a whirl.

Maybe Matt will add to the next Win32Lib.

Judith

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

Search



Quick Links

User menu

Not signed in.

Misc Menu