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.

I want to make a vertical RadioButtonBar in Manipulate. So far I only have a workaround that looks like this:

Manipulate[
  Which[
  sel == 0,
  Text["one"],

  sel == 1,
  Text["two"],

  sel == 2,
  Text["three"]
  ],
  Control[{{sel, 0, ""}, {0 -> "one"}, ControlType -> RadioButton}],
  Control[{{sel, 1, ""}, {1 -> "two"}, ControlType -> RadioButton}],
  Control[{{sel, 2, ""}, {2 -> "three"}, 
  ControlType -> RadioButton}],

  ControlPlacement -> Left
  ]

Is there any way not to have a line for each of the radiobuttons? Thanks!

share|improve this question
    
Take a look at RadioButtonBar if it helps. –  VLC Nov 21 '12 at 10:21

2 Answers 2

up vote 6 down vote accepted
Manipulate[
 Switch[sel,
  0, Text["one"],
  1, Text["two"],
  2, Text["three"]], {{sel, 0, ""}, {0 -> "one", 1 -> "two", 
   2 -> "three"}, ControlType -> RadioButtonBar, 
  Appearance -> "Vertical"}, ControlPlacement -> Left]

enter image description here

share|improve this answer
    
Great! Thanks a lot. - I did check for the 'Appearance -> "Vertical"' option, but obviously must have done something wrong. I'm glad it's working now. –  Mockup Dungeon Nov 21 '12 at 12:11

You can try the Dynamic function as follows:

DynamicModule[{sel}, 
 Panel[Row[{RadioButtonBar[
     Dynamic[sel], {1 -> "One", 2 -> "Two", 3 -> "Three"}, 
     Appearance -> "Vertical"], 
    Panel[Dynamic[
      Which[sel == 1, Text["one"], sel == 2, Text["two"], sel == 3, 
       Text["three"]]], ImageSize -> {50, 50}]}]]]

This avoids to to have a line for each of the radiobuttons.

share|improve this answer
    
I know DynamicModule is much more flexible, but unfortunately I did not have time yet to familiarise myself with it. - But thanks a lot for the suggestion! I'll keep the code and come back to it later. –  Mockup Dungeon Nov 21 '12 at 12:13

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.