MathGroup Archive 2009

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

Search the Archive

Re: strange effect of using Item[] around Control[] in Manipulate[]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg105582] Re: strange effect of using Item[] around Control[] in Manipulate[]
  • From: "Nasser M. Abbasi" <nma at 12000.org>
  • Date: Thu, 10 Dec 2009 04:55:43 -0500 (EST)
  • References: <hfnuvn$gc3$1@smc.vnet.net>

"Nasser M. Abbasi" <nma at 12000.org> wrote in message 
news:hfnuvn$gc3$1 at smc.vnet.net...
> Version 7,
>
> I use Item to help me arrange the layout of Controls more easily.
>
> I noticed the following "issue". Consider the following  example:
>
> Manipulate[Null,
>          Control[{{a, 5, "a"}, 1, 10, 1}],
>          Control[{{b, 0.5, "b"}, 0, a, 0.01}]
> ]
>
> In the above, control variable "b" has it maximum defined by the
> control variable "a".  This works ok. I us the above type construct in
> many placed since the maximum value of some variable depend on the
> setting of another variables.
>
> Now, if I wrap the above Controls in Item[], then the above will no
> longer get setup correctly:
>
> Manipulate[Null,
>         Item[Control[{{a, 5, "a"}, 1, 10, 1}]],
>         Item[Control[{{b, 0.5, "b"}, 0, a, 0.01}]]
> ]
>
> Now when running the above, notice that the second control is not set
> up, because now its maximum value "a" is no longer seen as a the other
> Manipulate control variable so its value is unknown.
>
> Wrapping Item[] around it caused this problem.
>
> Is this the expected behavior of Item in this context?
>

fyi, I can work around this easily by using wraping b with Dynamic, as 
follows

Manipulate[Null,
         Item[Control[{{a, 5, "a"}, 1, 10, 1}]],
         Item[Control[{{b, 0.5, "b"}, 0, Dynamic[a], 0.01}]]
 ]

--Nasser 



  • Prev by Date: Re: strange effect of using Item[] around Control[] in Manipulate[]
  • Next by Date: Re: Possible bug in Opacity[] with plotting function that uses UnitStep?
  • Previous by thread: Re: strange effect of using Item[] around Control[] in Manipulate[]
  • Next by thread: would like to compute a tensor derivative of a function and evaluate