Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using this code inside Manipulate:

     "custom", Control[{{names, True}, {True, False}}],
     "a", Control[{{slide, 0}, 0, 1}],
     "b", Control[{{setter, "das"}, {"das", "der", "die"}}]],
    {{cases, "custom"}, {"custom", "a", "b"}}

The variable cases is supposed to control which other control type is visible. However i get the following error message:

Manipulate::vsform: Manipulate argument Switch[cases,


does not have the correct form for a variable specification. >>

[...] is a placeholder which in mathematica displays the controls i specified above (Odd, right?). I cannot post screenshots yet unfortunately. Does anybody have an idea why this isn't working or how to better implement a manipulate control in which I can dynamically alter the number and types of the other controls?

share|improve this question
You can't do this. You can't put controls inside Switch, at least I never seen it before. But if you post full code, it will help try it out than spend time to try to recreate it. – Nasser Jul 7 '14 at 1:19
It would be helpful to those who would like answer your question to have your full Manipulate expression and support code it depends on. Please edit your question by adding that code. – m_goldberg Jul 7 '14 at 1:19
@Nasser. You're right, but if we had the full code, someone could provide a work-around. – m_goldberg Jul 7 '14 at 1:21
Somewhat related: 30003 and perhaps 40037 – Michael E2 Jul 7 '14 at 1:38
up vote 7 down vote accepted

Perhaps this?

  {names, slide, setter, cases},
    "custom", Control[{{names, True}, {True, False}}],
    "a", Control[{{slide, 0}, 0, 1}],
    "b", Control[{{setter, "das"}, {"das", "der", "die"}}]], 
  {{cases, "custom"}, {"custom", "a", "b"}}]

The variables seem to get localized properly even though the syntax coloring is wrong.

share|improve this answer
+1 -- Evidently Nasser and I were wrong in thinking one could not put a Switch in a Manipulate. – m_goldberg Jul 7 '14 at 2:03
@m_goldberg you can put anything in Manipulate ...but you can always do it easier with DynamicModule ;) – Mike Honeychurch Jul 7 '14 at 2:59
@m_goldberg But I qualified it by saying "at least I never seen it before." :) I was lazy to actually try it. But I learned something new today about Manipulate. – Nasser Jul 7 '14 at 3:00
Thank you, that works. Could have sworn I tried using Dynamic myself and it didn't work but I must be mistaken. – ChrisUnbroken Jul 7 '14 at 14:57
@ChrisUnbroken You're welcome. I've certainly had that feeling, too. – Michael E2 Jul 8 '14 at 3:04

Your Answer


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.