Nested Manipulate and LocalizeVariables -> False
- To: mathgroup at smc.vnet.net
- Subject: [mg114494] Nested Manipulate and LocalizeVariables -> False
- From: Dean Shough <dean at shough.com>
- Date: Sun, 5 Dec 2010 21:56:10 -0500 (EST)
I have a need to nest Manipulates, but using global variables instead of
local variables. I tried using the example shown in the advanced
manipulate tutorial with the addition of LocalizeVariables -> False.
The code I tried is
Manipulate[
With[{value = Table[c[i], {i, 1, n}],
controls = Sequence @@ Table[{c[i], 0, 1}, {i, 1, n}]},
Manipulate[value, controls, LocalizeVariables -> False]], {n, 1,
10, 1}, LocalizeVariables -> False]
The output look fine but the sliders do not move. My next attempt
splits the two Manipulates.
Manipulate[n, {n, 1, 10, 1}, LocalizeVariables -> False]
and
With[{value = Table[c[i], {i, 1, n}],
controls = Sequence @@ Table[{c[i], 0, 1}, {i, 1, n}]},
Manipulate[value, controls, LocalizeVariables -> False]]
Everything looks good at first glance, the c[i] sliders move and cause
the values to change. But nothing propagates outside the Manipulate!
In[236]:= Table[c[i], {i, 1, n}]
Out[236]= {c[1], c[2], c[3]}
How should this be done? And how would this be done using lists and
parts ( c[[i]] instead of c[i] )?
----
Dean