Consider the following code
Manipulate[n,
Dynamic@Grid[{
{"n", Control[{{n, 1, ""}, 1, 10, 1, Appearance -> "Labeled"}]},
{"eq1", Control[{{eq1, x == 1, ""}, InputField, ImageSize -> Small}]}
}],
Alignment -> {{Right, Left}, Automatic}, ControlPlacement -> Left]
Now, my goal is to generate n
InputField
-type controls. That is, whenever I change the value of n
, I add or remove equation controls with not only the correct labelling (eq1
, eq2
, etc), but also the correct variable labelling (within the Control
, I get {eqi,x==1,""}}
for each i
between 1 and n
). How can I do this efficiently?
A first idea that occured to me was to simply use Table
, something like
Manipulate[n,
Dynamic@Grid[{
{"n", Control[{{n, 1, ""}, 1, 10, 1, Appearance -> "Labeled"}]},
Table[{"eqi",
Control[{{eqi, x == 1, ""}, InputField, ImageSize -> Small}]}, {i, n}]
}],
Alignment -> {{Right, Left}, Automatic}, ControlPlacement -> Left]
where I am, for the moment, ignoring the relabelling bit (i
should be 1, 2, etc). This, however, doesn't work, since I get
I tried to use Flatten
, Column
and Sequence@@
, but no success. I want to have something like
In the end, I have two questions:
- How do I fix the layout of the
Table
controls? - How do I introduce new variables and controls with the correct ordered labelling?
Any ideas/suggestions are appreciated.
StringForm
does the trick. I still don't know how to do the variable labelling though. $\endgroup$