1
$\begingroup$

I'm using PaneSelector in my Manipulate controls to change the limits on a variable for 3 (or more) different selections. Here 2/3 of the controls are the same, while the other has a different range. How can I use PaneSelector (or similar) and eliminate duplicate controls?

Control[{{tab,1},{1->"func A",2->"func B",3->"func C"},Setter}],
PaneSelector[{
1->Control[{{maxrange,5},1,10}],
2->Control[{{maxrange,5},1,10}],
3->Control[{{maxrange,15},10,20}]
},Dynamic@tab]

Since the first two controls are exactly the same, is there a way to consolidate?

$\endgroup$
0
1
$\begingroup$
PaneSelector[{1 -> Control[{{maxrange, 5}, 1, 10}], 3->Control[{{maxrange, 15}, 10, 20}]}, 
  Dynamic[tab /. 2 -> 1]]

or

PaneSelector[{## & @@ Thread[{1, 2} -> Control[{{maxrange, 5}, 1, 10}]], 
   3 -> Control[{{maxrange, 15}, 10, 20}]}, Dynamic@tab]
$\endgroup$

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.