# Create a user interface and stand alone application using Wolfram Language?

Posted 4 months ago
652 Views
|
10 Replies
|
0 Total Likes
|
 Hi, I have a question about the creation of a stand-alone application and the relative user interface.I have created many notebooks ok Mathematica using the Button, CreateDialog, Input Field and so on, but i have noticed that the code is hard to hide... For example, if there are some errors during the computation and Mathematica Print the errors, the hidden code appear...Here is the question: I have created a code for signal processing and data analysis. Are there a possibility to create a stand-alone application, that uses the Mathematica Kernel obviously but that appears only with buttons, menus etc. with which the user can interact to insert data, file path etc.. and start the analysis without seeing the code, in other words, an application with graphical user interface?I'd like to create a user-friendly software for users that haven't any knowledge of Wolfram Language.Thank you
10 Replies
Sort By:
Posted 4 months ago
 Have you tried SaveDefinitions? It should make the output cell self-contained, so that you can delete the source code.
Posted 4 months ago
 Thank you, but SaveDefinitions is an option of Manipulate and i don't use that function...A very small example of what i mean: Button["Create an energy calibration", fit = CreateDialog[ Column[{"Insert a pair of point like {voltage,energy}", InputField[Dynamic[pointcal]], Button["Proceed", fit = Fit[pointcal, {1, x}, x]; DialogReturn[fit] , ImageSize -> Automatic]}]]; ] The user clicks on this button and inserts the required data and the computation is performed. This is a simple example, so if i hide the code with the cell on the right it works, but for more complicated codes is fore difficult and it is always not "safe" as i wrote in the previous post (with an error the code appear)Thank you
Posted 4 months ago
 How about Quiet? This should suppress error messages.
Posted 4 months ago
 Andrea, designing a Mathematica application is a good idea. If you are interested in a guide to how to design a pretty much standard application look at A Mathematical Style at my web site. I would be wary of writing notebooks for others that are just buttons and dynamic displays. It might be better to write 'literate' notebooks that have textual discussion mixed with the displays and look more like a paper. Most dynamic displays are not that self-explanatory.A second method for hiding code, beside double clicking on the cell bracket, is to use the Mathematica Menu, Cell, Cell Properties/ Open command. (Alt+CPO) This semi-permanently closes a cell. The reader can open it if he wishes but normally it will stay closed, even between sessions. One advantage is that you can have textual discussion, hidden code, and then output so the notebook reads like a paper. Another advantage is that most code for many displays, such as graphics or dynamic displays, is one-off and it's very convenient to put it just where it's used.The disadvantage is that the closed cell is very narrow and readers might miss it and not evaluate it. My solution to this was to design an 'Eval' button, which I insert in a Text cell before the code that automatically evaluates the code cell, keeping the cell shut. I have an application, Presentations, which is a help in writing literate notebooks. There is a button on the Presentations palette to paste the Eval button into a notebook so it's very convenient and I use it a lot. If you would like a copy of Presentations write me and introduce yourself and I'll send you a link.Another technique with complicated displays is to put them in windows (which you already know how to do) that can be positioned next to the notebook. Then if there is a lengthy discussion in the notebook it can be scrolled without losing sight of the associated display.
Posted 4 months ago
 Lookup Manipulate, CDF (format) and related topics.There are few tutorials too:
Posted 4 months ago
 Thank you David, you gave me some useful ideas! The simple option of "open cell" seems powerful, and there is no problem with the missing of the cells because there will be ever a button to evaluate it!I understand and share your opinion about an only-graphics application, in fact, my idea is that there will be some text explanation but i don't want to show the code to users, because it's not necessary and can cause problems...As soon as possible, i'll send you an email for the presentation.If i include a Print function in the code, every time i evaluate it a new output cell is created. Do you know how to force to update the previous output with the new one (to create only one output cell)?Thank you Kuba, but the application can't be included in one or more Manipulate functions
Posted 4 months ago
 [...] the application can't be included in one or more Manipulate functions Because? While Manipulate can be too top level, see related DynamicModule examples. It supports SaveDefinitions option too.And in case you have a well written package you can include it using those tips:How can I include functions from a package into a CDF file?
Posted 4 months ago
 Andrea, If i include a Print function in the code, every time i evaluate it a new output cell is created. Do you know how to force to update the previous output with the new one (to create only one output cell)? Look at PrintTemporary[] -- You can replace a print with a new one and control the display of information. For example, you can print some update information and clean it all up at any point.Regards,Neil