Message Boards Message Boards

0
|
5318 Views
|
1 Reply
|
1 Total Likes
View groups...
Share
Share this post:

Get Slider range to change with Manipulate variable?

Posted 5 years ago

All:

I'm working on a demonstration, and having an issue getting the slider values to cooperate. The code below isolates the issue. I'd like for the a value to reset to the new initial value when I click the button. In this code, the slider boundaries change (which is good), but the existing a value is inherited rather than resetting to the new initial value.

Appreciate any and all advice!

Manipulate[

 a,

 {{b, 1, "direction"}, {1 -> "Left to Right", 2 -> "Right to Left"}},
 PaneSelector[{
   1 -> Control[{{a, -1, "x"}, -1, 1.99999, Appearance -> "Labeled"}],
   2 -> Control[{{a, 4, "x"}, 2.00001, 4, Appearance -> "Labeled"}]
   }, Dynamic[b]],

 TrackedSymbols -> {a, b}
 ]
POSTED BY: Rob Holman
Posted 5 years ago

Maybe something similar to this?

Manipulate[
    If[dir != oldDir, a = -a; oldDir = dir];
    a,
    {{dir, 1, "direction"}, {1 -> "Positive", 2 -> "Negative"}},
    Dynamic@Switch[dir,
        1, Control@{{a, 0}, 0, 2, Appearance -> "Labeled"},
        2, Control@{{a, 0}, -2, 0, Appearance -> "Labeled"}
    ],
    {oldDir, 1, ControlType -> None},
    TrackedSymbols :> {dir, a}, AppearanceElements -> None
 ]
POSTED BY: Hans Milton
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract