Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Simple GUI Help' topicStudent Support Forum > General > Archives > "Simple GUI Help"

Help | Reply To Topic
Author Comment/Response
WL
04/02/13 5:37pm

Hello,

I've been using the GUIKIT provided by Mathematica to create some simple GUIs for a software package. I am having some trouble trying to save and load a list to a file and vice versa. I want the user to be able to choose the directory to save the file to, but I am not sure how to extract that information from the code provided by the Mathematica help files. The code provided for Save is:

Needs["GUIKit`"];
ref = GUIRun[
Widget["Panel", {Widget[
"Button", {"text" -> "Save File...",
BindEvent["action",
Script[Widget["FileDialog", Name -> "saveFileDialog"];
returnValue =
InvokeMethod[{"saveFileDialog", "showSaveDialog"}, Null];
If[
returnValue ===
PropertyValue[{"saveFileDialog", "APPROVE_OPTION"}],
PropertyValue[{PropertyValue[{"saveFileDialog",
"selectedFile"}], "path"}], Null]]]}],
Widget["Button", {"text" -> "Cancel"}]}]]


I am not sure how to use this source code. For example: I want to save the information a={1,2,3} to a text file called data.txt on my desktop. Is there some way to do that with this GUI code?

Thanks a lot

-W

URL: ,
Help | Reply To Topic