Re: ProgressIndicator inside DynamicModule

• To: mathgroup at smc.vnet.net
• Subject: [mg109842] Re: ProgressIndicator inside DynamicModule
• From: Patrick Scheibe <pscheibe at trm.uni-leipzig.de>
• Date: Wed, 19 May 2010 20:13:46 -0400 (EDT)

Hi,

but when it's just for showing progress of a calculation and not for
dynamically changing input and displaying the result, why don't you use
some simple construct like

count == 1;
input == RandomReal[{1, 50}, 5000];
ProgressIndicator[Dynamic[count], {1, Length[input]}]
complexFunc[x_] :== Nest[BesselJ[0, #] &, x, 20];
Do[(count++; complexFunc[input[[i]]]), {i, 1, Length[input]}]

What exactly is the reason to use a DynamicModule?

The problem in the construct with the DynamicModule and the Do-Loop
seems to be the reason that DynamicModule *needs* to display something
which should be updated dynamically. John Fultz gave already some very
exhaustive insights, how this works and what doesn't work. Maybe you

http://forums.wolfram.com/mathgroup/archive/2009/Feb/msg00424.html

Cheers
Patrick

Am May 19, 2010 um 3:06 PM schrieb Istv=E1n Zachar:

> Dear Patrick,
>
> Thanks for the help, but the problem is not solved.
> First of all, I did not state the problem is in the
> ProgressIndicator. I rather suggested that DynamicModule is the
> cause of 'misfunctioning'.
> Furthermore, your solution does not solve anything. My toy model
> represented a more complex situation, where I have an iterative
> function (a modified NDSolve, represented here with the Do loop),
> for which I want to check on the progress via a similar construct as
> StepMonitor. Thus you have thrown out the baby with the water by
> just retaining pr++.
> If I rewrite your version to mirror my issue, I end up with
> something like this:
>
> DynamicModule[{pr == 0, range == {0, 100}, sw == False}, Grid@{{
>     Button["Push me", sw == Not[sw]; pr == 0;],
>     Dynamic@ProgressIndicator[Dynamic@pr, range],
>     Dynamic@If[sw, Do[Pause[0.02]; pr == i, {i, range[[1]],
> range[[2]]}]; pr],
>     Dynamic@Switch[sw, True, "Calculating...", False, "Finished."]
>     }}]
>
> which AGAIN won't produce the correct behaviour for ProgressIndicator.
>
> Any other idea?
>
>
>
>
> On 2010.05.19. 14:04, Patrick Scheibe wrote:
>
> Hi,
>
> the problem is *not* the progress indicator but your button!
> The button-function does not update dynamically the values.
>
> DynamicModule[{pr == 0, range == {0, 100}, sw == False}, Grid@{
>    {Button["Push me", sw == Not[sw]],
>     Dynamic@ProgressIndicator[Dynamic@pr, range],
>     Dynamic@If[sw && pr < Last@range, Pause[0.02]; pr++, pr],
>     Dynamic@
>      Switch[sw, True, "Calculating...", False, "Finished.", _,
>       "Standing by."]}}]
>
> Cheers
> Patrick

• Prev by Date: Re: Latex, Mathematica, and journals
• Next by Date: Re: ProgressIndicator inside DynamicModule
• Previous by thread: Re: ProgressIndicator inside DynamicModule
• Next by thread: Re: ProgressIndicator inside DynamicModule