Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

up vote 10 down vote accepted

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.

share|improve this answer
1  
Do you know why that additional Dyanmic is required only in this case? –  rm -rf Mar 27 '12 at 15:41
    
No. I haven't a clue. –  David Carraher Mar 27 '12 at 15:46
    
Thank you so much David, this has been driving me nuts. –  Simon Woods Mar 27 '12 at 16:00
    
@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`. –  David Carraher Mar 27 '12 at 16:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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