6
$\begingroup$

I have a code which starts with the following Cell:

In[1]:= CreateDialog[
  Grid[
   {
    {"Year:", InputField[Dynamic[yyyy], Number]},
    {"Month:", InputField[Dynamic[mm], Number]},
    {"Day:", InputField[Dynamic[dd], Number]},
    {CancelButton[], 
     DefaultButton[DialogReturn[{year = yyyy, month = mm, day = dd}]]}
    },
   Spacings -> {1, Automatic}, Alignment -> Left
   ]
];

Now when I evaluate the whole Notebook, the following Cells evaluate before I finish entering the values in the CreateDialog.

How to stop all evolutions until the CreateDialog window is gone?

$\endgroup$

1 Answer 1

6
$\begingroup$

Using DialogInput instead of CreateDialog

DialogInput[
 Grid[{{"Year:", InputField[Dynamic[yyyy], Number]}, {"Month:", 
    InputField[Dynamic[mm], Number]}, {"Day:", 
    InputField[Dynamic[dd], Number]}, {CancelButton[], 
    DefaultButton[
     DialogReturn[{Year = yyyy, Month = mm, day = dd}]]}}, 
  Spacings -> {1, Automatic}, Alignment -> Left]]


Documentation:

Mathematica graphics

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.