Mathematica: Dialog button window to remain open after click

All,In summary, the conversation is about a button panel that runs a Mathematica script when a button is pressed. However, the panel closes after the script runs, and the speaker would like it to remain open so they can click another button. The panel should only close when the "done" button is clicked. The code for the button panel and script is also provided.
  • #1
ChristinaJ
Gold Member
35
1
All,

I have a button panel (code below) where a pressed button initiates a particular Mathematica script.

When the button is pressed the script runs (as it should) but the panel closes. I wish for the panel to remain open so that I can click another button. The panel should close only when the done button is clicked.

Code:
menu = DialogInput[
   DialogNotebook[{Column[{TextCell[
        Row[{Style["I would like to ...", FontWeight -> Bold]}], 
        "Text"], 
       Row[{Button["Run A", DialogReturn["1"]], 
         Button["Run B", DialogReturn["2"]],
         Button["Run C", DialogReturn["3"]]}],
       Button[Done, DialogReturn[]]}]}]];

If[Mags == "1", 
 Get["A.m"]]
If[Mags == "2", 
 Get["B.m"]]
If[Mags == "3", 
 Get["C.m"]]

Any help appreciated.

Many thanks,
Christina
 
Physics news on Phys.org
  • #2


Solved here thanks to comp.soft-sys.math.mathematica
 
Last edited:

1. What is Mathematica?

Mathematica is a software program used for mathematical and scientific computing. It is commonly used by researchers, engineers, and scientists to perform complex calculations, data analysis, and visualization tasks.

2. How do I create a dialog button window in Mathematica?

To create a dialog button window in Mathematica, you can use the CreateDialog function. This function takes in a list of elements that you want to include in the window, such as buttons, text boxes, and graphics. You can also specify the title and size of the window using additional parameters.

3. How can I make a dialog button window remain open after clicking a button?

To make a dialog button window remain open after clicking a button, you can use the Modal -> False option when creating the window. This will prevent the window from automatically closing after a button is clicked, allowing you to continue interacting with the window until you manually close it.

4. Can I customize the appearance of the dialog button window in Mathematica?

Yes, you can customize the appearance of the dialog button window in Mathematica by using the DialogSettings function. This function allows you to specify various visual aspects of the window, such as the background color, font style, and button layout.

5. Are there any tutorials or resources available for learning how to use dialog button windows in Mathematica?

Yes, there are many tutorials and resources available for learning how to use dialog button windows in Mathematica. The official Mathematica documentation provides detailed explanations and examples of how to create and customize dialog button windows. Additionally, there are many online forums and communities where users share tips and tricks for using Mathematica, including creating dialog button windows.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • Programming and Computer Science
Replies
1
Views
2K
  • Aerospace Engineering
Replies
2
Views
7K
Back
Top