I need to duplicate a simulation inside one DynamicModuleDynamicModule
. I believe It'sit's simpler to understand using an toy example. Here is the start screen:
Now if I play with a
value, like this...
and then press Add
button, I get:
with the first module resetedreset.
Someone know how can I preserve the Manipulate'sManipulate
's states, when I Add
or Remove
an iten?
Here is my current code:
DynamicModule[{myCDF,controls,grid,btn},
myCDF[]:=Manipulate[Plot[Sinc[a x],{x,0,10}],{{a,1},1,10}];
grid={myCDF[]};
btn["Add"]=Button["Add",AppendTo[grid,myCDF[]]];
btn["Rem"]=Button["Remove",If[Length[grid]>1,grid=grid[[1;;-2]]]];
controls=Grid[{{btn["Add"],btn["Rem"]}}];
Dynamic@Panel[Column[{Grid[Transpose@{grid}],controls}]]
]