Re: FileNameSetter button return state
- To: mathgroup at smc.vnet.net
- Subject: [mg84325] Re: FileNameSetter button return state
- From: dh <dh at metrohm.ch>
- Date: Wed, 19 Dec 2007 04:13:55 -0500 (EST)
- References: <fk55rt$141$1@smc.vnet.net>
Hi Steve,
here is a dirty trick:
Append a space to your file name. If on return the space is still there,
"Cancel" was chosen. Otherwise the space is gone.
hope this helps, Daniel
Steve Luttrell wrote:
> I want to use FileNameSetter to create a button which behaves in the
> expected way for implementing a Save As... functionality.
>
> So I did this
>
> FileNameSetter[Dynamic[filename], "Save", Appearance -> "Save File..."]
>
> This is fine, except that I can't find any way to determine whether the "OK"
> or "Cancel" button is used to exit the file dialog box. It is not sufficient
> to determine if the value of filename changes, because if you leave filename
> unchanged and use the "OK" button to exit the dialog then this appears to be
> indistinguishable from using the "Cancel" button.
>
> I can't find anything in the documentation about how to do this. I tried to
> use the {fstart,f,fend} functionality of Dynamic, but this caused
> FileNameSetter to break.
>
> Stephen Luttrell
> West Malvern, UK
>
>