Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
|
|
Help with dynamic functionality
Posted:
Nov 28, 2012 3:16 AM
|
|
My actual problem is quite involved but I am including a simple example for illustrative purposes. I am trying to reproduce "Enabled"-like functionality as follows:
Clear[y, SliderModule]; SetAttributes[SliderModule, HoldAll]; SliderModule[enabled_] := DynamicModule[{x = 0}, {Slider[ Dynamic[x, (x = If[enabled, #, 0]) &]], Dynamic[x]}] {Checkbox[Dynamic[y]], Dynamic[y], SliderModule[y]}
Ideally when the checkbox is checked then the user is able to move the slider; but when it is unchecked the slider resets to zero. The problem is when I uncheck the checkbox the slider doesn't reset to zero until I click on the slider itself. Is there a way to get the slider to immediately reset when I uncheck the checkbox? Please remember that this is a simplification of my actual problem so try to keep the SliderModule structure the same.
Cheers, Sam
|
|
|
|