13
$\begingroup$

Some controls do not appear to work with Manipulate inside a DialogInput. For example:

DialogInput[{Manipulate[x, {x, {1, 2, 3}}], DefaultButton[]}]

does not work, but the slider version:

DialogInput[{Manipulate[x, {x, 1, 3, 1}], DefaultButton[]}]

does work.

Is this a bug or am I missing a vital option setting?

$\endgroup$
10
$\begingroup$

Try

DialogInput[{Manipulate[Dynamic[x], {{x, 2}, {1, 2, 3}}, 
   LocalizeVariables -> False], Button["OK", DialogReturn[x]]}]

I'm not sure why Dynamic is required.

LocalizeVariables -> False allows the value of x to be returned (outside of the scope of the Manipulate. LocalizedVariables was shown to be necessary for a Manipulate embedded in DialogInput. See here.

$\endgroup$
  • 1
    $\begingroup$ Do you know why that additional Dyanmic is required only in this case? $\endgroup$ – rm -rf Mar 27 '12 at 15:41
  • $\begingroup$ No. I haven't a clue. $\endgroup$ – DavidC Mar 27 '12 at 15:46
  • $\begingroup$ Thank you so much David, this has been driving me nuts. $\endgroup$ – Simon Woods Mar 27 '12 at 16:00
  • $\begingroup$ @Simon Glad to be of help. I still find it strange that Manipulate[x, {{x, 2}, {1, 2, 3}}] works fine by itself, with x behaving like a dynamic variable within Manipulate when Manipulate is not embedded in DialogInput`. $\endgroup$ – DavidC Mar 27 '12 at 16:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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