In this code, one cannot close the dialog window:

{TogglerBar[Dynamic[x], Range[5]], Dynamic[x],  Dynamic[CreateDialog[x]]}

If I use DynamicModule this way, the dialog window will not pop up when it was closed and re-chosen some values.


So how to make the created dialog window could be closed and reopen when click to set different values by TogglerBar

  • $\begingroup$ In the first example you give, you can close the dialog. It just so happens a new one is created whenever you close an old one. You can notice this through the names changing in the output. In the second case, you forgot your Dynamic around CreateDialog if that was what you are asking about. Perhaps you are simply looking for CreateDialog[Dynamic@y] ? $\endgroup$
    – jVincent
    May 16, 2013 at 9:31
  • $\begingroup$ @jVincent Yeah, The first case just generate too many NotebookNojects. The second case: what I'm really looking for is How to Reopen the Dialog via Clicking in the TogglerBar. CreateDialog[Dynamic[y]] or Dynamic[CreateDialog[y]] seems doesn't work well. $\endgroup$ May 16, 2013 at 9:42

1 Answer 1


I'm not sure if this fully answers your question, but here is a method of using the Dynamic to check if a dialog is already open and reopen it if it has been closed:

DynamicModule[{nb = CreateDialog[Dynamic@y]},
  Dynamic[y, (y = #;If[Not@MemberQ[Notebooks[], nb],nb = CreateDialog[Dynamic@y]]) &], 
  • $\begingroup$ haha, that's right - thanks. $\endgroup$ May 16, 2013 at 10:04

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.