But even with this it doesn't seem to pause and wait. In the code below, it should bring a matrix of InputFields and then when you increase n (main entry variable), it should Insert a row in the matrix, but it doesn't:
Clear[f, kk];
T = {}; kk = Null;
InputField[Dynamic[n,
{n = #;
AppendTo[T, n];
If[Length[T] == 1, A = Array[c, 3 n],
If[Length[T] >= 2,
DialogInput[
DialogNotebook[{TextCell["Where to insert new rows? "],
InputField[Dynamic[nm], String],
Row[{DefaultButton[DialogReturn[kk = nm]],
CancelButton[]}]}]];
A =
Flatten@Insert[A, Table[c, {i, 3 ( T[[-1]] - T[[-2]])}],
3 kk]; Print[kk];
]
];
Print[kk];
Print@
Grid[Table[{"Amp", i, " = ",
With[{i = i},
InputField[Dynamic[A[[3 i - 2]]], FieldSize -> Tiny]],
"\[Mu]", i, " = ",
With[{i = i},
InputField[Dynamic[A[[3 i - 1]]], FieldSize -> Tiny]],
"\[Sigma]", i, " = ",
With[{i = i}, InputField[Dynamic[A[[3 i]]], FieldSize -> Tiny]]
}, {i, n}]];
f = Sum[
A[[3 i - 2]] *Sqrt[2 \[Pi]]
A[[3 i]] PDF[NormalDistribution[A[[3 i - 1]], A[[3 i]]],
t], {i, n}];
Print@
Show[ListPlot[gr3, Joined -> True],
Plot[f, {t, -1.8, -1.10}, PlotStyle -> Red]]
} &]]
Not sure I understand why.