MathGroup Archive 2008

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

Search the Archive

Re: Grouping and constraining slider controls

  • To: mathgroup at smc.vnet.net
  • Subject: [mg91291] Re: Grouping and constraining slider controls
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Wed, 13 Aug 2008 04:42:17 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <g7riie$i8e$1@smc.vnet.net>

Tim Heger wrote:

> First - I am as green as it comes to Mathematica and have tried to RTFM 
> to find my answer but alas I have come up short and need some help.  I 
> want to group X number of slider controls that each have a value range 
> from 0 to 100 and constrain this group so that the total of the values 
> from the group is not greater than 100 (representing 100%).  So in 
> theory slider 1 starts at 100% and has other sliders are moved they 
> decrement proportionally the other sliders that are currently greater 
> than 0.

I think that you are looking for something along the lines:

     DynamicModule[{x = 100},
      Column[{{Slider[Dynamic[x], {0, 100, 1}],
         Dynamic[x]}, {Slider[
          Dynamic[100 - x, (x = 100 - #) &], {0, 100, 1}],
         Dynamic[100 - x]}}]]

The tutorial "Introduction to Dynamic" explains in detail how a control 
can control another control and most of the examples are with sliders.

tutorial/IntroductionToDynamic

http://reference.wolfram.com/mathematica/tutorial/IntroductionToDynamic.html

HTH,
-- Jean-Marc


  • Prev by Date: minimize with complex numbers
  • Next by Date: Re: Re: Integrating DiracDelta to get UnitStep
  • Previous by thread: Grouping and constraining slider controls
  • Next by thread: Re: Grouping and constraining slider controls