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

Is it possible to use Manipulate and Switch to change the Manipulate controls?

    controls = ...,
    controls = ...]],

Where Manipulate controls would be different for each type.

share|improve this question
up vote 13 down vote accepted

There are various viewers available that could used to switch between different arrangements of controls. For a seamless look, one might use PaneSelector. If type is to have its own control, putting it inside each of the panes ensures Manipulate will align them.

 {x, yyy},
 {{x, a}, {a, b, c, d}, None},
 {{yyy, 0.5}, 0, 1, None},
 {{type, 1}, Range@3, None},
   1 -> Column[{
      Control@{x, {a, b, c, d}, RadioButtonBar},
      Control@{{yyy, 0.5}, 0, 1},
      Control@{type, Range@3}
   2 -> Column[{
      Control@{x, {a, b, c, d}, SetterBar},
      Control@{type, Range@3}
   3 -> Column[{
      Control@{x, {a, b, c, d}, PopupMenu},
      Control@{{yyy, 0.5}, 0, 1},
      Control@{type, Range@3}
   }, Dynamic@type]     

enter image description here

Comment: Your question suggests you might be seeking rather fine control over the UI. It might be easier in the long run to build it from the ground up with DynamicModule and the various user interface features Mathematica offers.

share|improve this answer

  typeSelected == 1,Row[{"you selected type 1 UI with input h = ", h}],
  typeSelected == 2,Row[{"you selected type 2 UI with input mass = ", m}],
  True, "No way ! Please report a bug"]

   {Style["A self modifying dynamic Manipulate UI" , 10], SpanFromLeft},

   {"Which UI would you like to see?", 
      {1,"type 1" ->Row[{"h? ", SetterBar[Dynamic[h, {h = #} &], {0, 1, 2}]}]},
      {2,"type 2" -> Row[{"mass= ",Manipulator[Dynamic[m, {m = #} &], {0, 100, 1}], 
      }, Dynamic[typeSelected]
   }, Frame -> All, Spacings -> .5, FrameStyle -> Gray],

 {{h, 1}, None},
 {{m, 4}, None},
 {{typeSelected, 1}, None},
 TrackedSymbols :> {h, m, typeSelected}     

Mathematica graphics Mathematica graphics

share|improve this answer

Using the command

 ControlType ->

and then listing the type of control you want, such as SetterBar, Manipulator, or Slider at the end of your Manipulate function allows you to customize the controls. Mathematica will also automatically change the control based on the data put in (i.e., if you put in code like this {frame, {True, False}} it will give a checkbox).

share|improve this answer

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.