MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Help with dynamic functionality

  • To: mathgroup at
  • Subject: [mg128822] Re: Help with dynamic functionality
  • From: "Nasser M. Abbasi" <nma at>
  • Date: Thu, 29 Nov 2012 06:02:26 -0500 (EST)
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • References: <k94h9k$bh5$>
  • Reply-to: nma at

On 11/28/2012 2:16 AM, samid.hoda at wrote:
> 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

   Slider[Dynamic[slider], Enabled -> Dynamic[checkbox]],
   Checkbox[Dynamic[checkbox, {checkbox = #; If[Not[checkbox],slider = 0]} &]]}


  • Prev by Date: WorkLife FrameWork update for Mathematica 9
  • Next by Date: DistributionChart and scaling
  • Previous by thread: Re: Help with dynamic functionality
  • Next by thread: Re: Help with dynamic functionality