Mathematica: Dialog button window to remain open after click

  • Context: Mathematica 
  • Thread starter Thread starter ChristinaJ
  • Start date Start date
  • Tags Tags
    Mathematica Window
Click For Summary
SUMMARY

The forum discussion addresses the issue of a DialogInput panel in Mathematica closing after a button press, which prevents users from executing multiple scripts in succession. The provided code snippet demonstrates the creation of a button panel that runs specific Mathematica scripts based on user selection. The solution involves modifying the DialogInput to ensure the panel remains open until the "Done" button is clicked, allowing for multiple script executions without reopening the panel. This solution was confirmed as effective by the community, specifically in the comp.soft-sys.math.mathematica forum.

PREREQUISITES
  • Familiarity with Mathematica programming language
  • Understanding of DialogInput functionality in Mathematica
  • Knowledge of button creation and event handling in Mathematica
  • Basic scripting in Mathematica for executing external files
NEXT STEPS
  • Explore advanced DialogInput options in Mathematica
  • Learn about event handling in Mathematica for interactive applications
  • Investigate the use of Dynamic modules in Mathematica for enhanced interactivity
  • Review best practices for structuring user interfaces in Mathematica
USEFUL FOR

Mathematica users, particularly those developing interactive applications or scripts, as well as educators and researchers looking to enhance user experience in their Mathematica projects.

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 ·
Replies
1
Views
2K
Replies
9
Views
3K
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 2 ·
Replies
2
Views
11K