Mathematica Mathematica: Dialog button window to remain open after click

  • Thread starter Thread starter ChristinaJ
  • Start date Start date
  • Tags Tags
    Mathematica Window
AI Thread Summary
The discussion revolves around a button panel in Mathematica that executes scripts when buttons are pressed. The issue is that the panel closes after a button is clicked, which prevents the user from executing multiple scripts in one session. The desired functionality is for the panel to remain open until a "Done" button is clicked, allowing for multiple button presses. A solution was found through the comp.soft-sys.math.mathematica forum, indicating that the issue can be resolved with adjustments to the dialog input settings.
ChristinaJ
Gold Member
Messages
34
Reaction score
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


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

Similar threads

Replies
1
Views
2K
Replies
2
Views
9K
Back
Top