Hi, I just don't get my head around this... when I call a Module with a Dynamic expression (i.e. a progress indicator), this works fine unless I call the same code from Button[]. See below sample code... when calling bigFunc[] standalone from the notebook, everything works fine. When it gets called on the push of the Button[], the progress indicator doesn't move, and the progress dialog window also doesn't close.
What causes this? My intention is to call some Modules that process loads of data (thus the progress indicator dialog...) from a window with buttons, as a menu.
Using DynamicModule in any combination doesn't seem to make a difference... I couldn't find any hint anywhere in the documentation... Mathematica 11.3 on MacOS 10.14.3
Any thoughts, help - thank you!
In[42]:= doSomething[i_] := Module[{},
Speak[progi]; Pause[2]; progi++;
];
bigFunc[] := Module[{},
progi = 1; proglen = 3;
prognb =
CreateDialog[
Column[{Style[
"Doing, " <> ToString[proglen] <> " things in total",
FontSize -> 12],
Row[{ProgressIndicator[Dynamic[progi], {1, proglen},
ImageMargins -> 5], " ",
Dynamic[Round@N[100 progi/proglen]], " %"}]}],
WindowSize -> Fit];
Table[doSomething[i], {i, 1, 3}];
NotebookClose[prognb];
];
callFromButton[] := Module[{},
Button["Start!", bigFunc[]]
]
In[45]:= bigFunc[] (** works fine! **)
In[46]:= callFromButton[] (** doesn't work! **)
Attachments: