Re: FileNameSetter button return state
- To: mathgroup at smc.vnet.net
- Subject: [mg84378] Re: FileNameSetter button return state
- From: "Steve Luttrell" <steve at _removemefirst_luttrell.org.uk>
- Date: Thu, 20 Dec 2007 00:17:17 -0500 (EST)
- References: <fk55rt$141$1@smc.vnet.net> <fk7424$6j5$1@smc.vnet.net> <fk87r6$4cv$1@smc.vnet.net> <fkao9k$dr3$1@smc.vnet.net>
Yes, I can see how to do it the way that you suggest.
In my original posting I was wondering whether it was possible to do it with
FileNameSetter[Dynamic[filename, {fstart,f,fend}], "Save", Appearance ->
"Save File..."]
but it didn't work. I had hoped that I could use the function fend to catch
the exit from the File Save dialog and then take appropriate action. It
would be quite neat if you could do everything (i.e. pick a file name, then
take whatever immediate action is needed based on the mode of exit from the
file dialog) within a single function call.
Stephen Luttrell
West Malvern, UK
"Albert Retey" <awnl at arcor.net> wrote in message
news:fkao9k$dr3$1 at smc.vnet.net...
> Steve Luttrell wrote:
>> Suppose that the file selection dialog starts up with a valid filename
>> (e.g.
>> the filename that you had used on a previous use of this dialog), but
>> then
>> you decide to press the "Cancel" button, how would you tell that it was
>> "Cancel" rather than "OK" that you had just pressed?
>
> I don't know how to do this with FileNameSelector, but it can be
> achieved with a combination of Button and SystemDialog["FileSave"] or
> SystemDialog["FileOpen"].
>
> I have done this and found it pretty straight forward, so if you need
> more information I could try to find the code snippet, but probably you
> are faster rewriting it your way. The only pitfall I can remember is
> that you need to use Method -> "Queued" for the Button, otherwise the
> preemptive link is likely to time out...
>
> hth,
>
> albert
>