Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #12494

Help with dynamic functionality

From samid.hoda@gmail.com
Newsgroups comp.soft-sys.math.mathematica
Subject Help with dynamic functionality
Date 2012-11-28 08:16 +0000
Message-ID <k94h9k$bh5$1@smc.vnet.net> (permalink)
Organization Time-Warner Telecom

Show all headers | View raw


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

Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Help with dynamic functionality samid.hoda@gmail.com - 2012-11-28 08:16 +0000
  Re: Help with dynamic functionality "Nasser M. Abbasi" <nma@12000.org> - 2012-12-03 08:17 +0000
  Re: Help with dynamic functionality awnl <awnl@gmx-topmail.de> - 2012-12-03 08:19 +0000

csiph-web