Dear colleagues,
I try to write the well-known design of the controls in a compact form, using the concept of a pure function.
Source:
DynamicModule [ { mm = Array [m, 5],n },
Column[{
Row [{"n " , Slider[Dynamic[n], {1, 5, 1}], Dynamic[n] }],
Dynamic[Grid[
Table[
With[{i = i }, { "m" <> ToString [i] , Slider[Dynamic[m[i]], {1, (11 - n), 1} ], Dynamic [m[i]] }], {i, n}]
]] }]
]
The modified code:
DynamicModule [ { mm = Array [m, 5],n },
cont = Row [{ #1 , Slider[Dynamic[ #2 ], {1, #3, 1}], " ", Dynamic[ #2 ] }]&;
Column[{
cont ["n ", n , 5],
Dynamic[Grid[
Table[
With[{i = i }, { cont [ "m" <> ToString [i] , m[i] , (11 - n) ] } ], {i, n}]
]] }]
]
It is clear that the problems lie in the assignment inside Table[ ]
Thanks in advance for your support. E.T.