[Date Index]
[Thread Index]
[Author Index]
Re: Nested Manipulate and LocalizeVariables -> False
*To*: mathgroup at smc.vnet.net
*Subject*: [mg114556] Re: Nested Manipulate and LocalizeVariables -> False
*From*: Dean Shough <dean at shough.com>
*Date*: Tue, 7 Dec 2010 06:49:03 -0500 (EST)
I can give an answer to my own question. By dumping Manipulate and using Dynamic instead I get:
n == 5;
x == Table[RandomReal[], {20}];
Column[{
Row[{Slider[Dynamic[n], {1, 10, 1}], Dynamic[n]}],
Dynamic[Column[Table[With[{i == i},
Row[{Slider[Dynamic[x[[i]]]], Dynamic[x[[i]]]}]
], {i, n}]]]}]
This was taken from the Dynamic tutorial with the outermost DynamicModule stripped off. I had tried for over a week using Manipulate with no progress. Once I gave up it took me just one morning of reading plus a few minutes in Mathematica to get something that works. Hopefully the real problem will go smoothly.
----
Dean
On Dec 5, 2010, at 6:56 PM, Dean Shough wrote:
> 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
>
>
Prev by Date:
**Re: Counting number of numbers in a large list between two valus**
Next by Date:
**Re: Counting number of numbers in a large list between two valus**
Previous by thread:
**Nested Manipulate and LocalizeVariables -> False**
Next by thread:
**ANN: CMake module for Mathematica**
| |