I've recently struggling with Buttons. So I understand Buttons have the form Button["text",action]
. Now I want the action
to be some sort to function defined to show a progress bar, so I can achieve the effect of showing a progress bar after pressing the button, inside a 'Panel' of DynamicModule
for example. (One answer pointed below can display the progress bar but it is displayed after DynamicModule
, making it invisible if the content of DynamicModule
is a full page)
Here is the simple code I have:
DynamicModule[{i = 0},
Button["Show Bar", i++; SomeFunction[]]]
and the definition of some function:
SomeFunction[] := Monitor[Table[1; Pause[0.1], {j, 1, 10}],
ProgressIndicator[j, {0, 11}]]
If I run SomeFunction[]
by itself, the progress bar shows nicely. If I click the button, though, I didn't see any thing. Any idea why? (Because I didn't specify how to display the output of the function?).
Thanks.
Comments
Post a Comment