1
$\begingroup$

I would like to have a Manipulate object with a 2D slider whose boundaries change dynamically depending on other controls.

For linear sliders this seems to work as expected. As i increases the lower bound for j increases too.

Manipulate[j,{i, 1, 10, 1},{j, i, 10, 1}]

sample code output

But if I do this for a 2D slider control, I get something weird:

Manipulate[P,{a, 0, 1, 0.01},{P, {a, 0}, {1, 1}}]

sample code output

If works if I nest two Manipulates, but this doesn't look that pretty:

Manipulate[Manipulate[P, {P, {a, 0}, {1, 1}}], {a, 0, 1, 0.01}]

sample code output

What am I doing wrong?

$\endgroup$
  • $\begingroup$ This works "out of the box" for me using 10.0.1 on OS X 10.9.5 What V and platform are you using? $\endgroup$ – Mike Honeychurch Sep 30 '14 at 21:23
  • $\begingroup$ @MikeHoneychurch: This is Mathematica 9.0.0.0 on OS X 10.8.5. If it works as expected for you on your newer setup, it sounds like this was a bug. But the best kind of bug, that has a workaround and is fixed in the current release. $\endgroup$ – Matthew Leingang Oct 1 '14 at 16:31
1
$\begingroup$

I think you need something like

Manipulate[P, {a, 0, 1, 0.01}, {P, {a, 0}, {1, 1}, ControlType -> Slider2D}]

enter image description here

$\endgroup$
  • $\begingroup$ Aha, works! As I understand it, Mathematica tries to guess the best control type based on the parameter description, and ControlType can be used to force a particular control. I'm surprised that it needs to be forced here but I'll take it. $\endgroup$ – Matthew Leingang Sep 30 '14 at 15:52
  • $\begingroup$ @MatthewLeingang, that's the way i also understand it. $\endgroup$ – kglr Sep 30 '14 at 15:59

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.