MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: ProgressIndicator inside DynamicModule

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

Hi,

the problem is *not* the progress indicator but your button!
The button-function does not update dynamically the values.
What about:

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

Am May 19, 2010 um 1:03 PM schrieb Zachar Istv=E1n:

> Dear Group,
>
> dealing with dynamic functions is very frustrating: every now and then
> a problem appears, which is totally against my previous experience and
> knowledge, and I am simply not able to resolve it. Here is a new one,
> any help would be welcome.
>
> Why does ProgressIndicator won't work inside DynamicModule, where
> 1. it works without enclosing the Grid in DynamicModule,
> 2. the 'sw' switch is correctly displayed (but not 'pr').
> ??
>
> DynamicModule[
> {pr == 0, range == {0, 100}, sw == False},
> Grid@{{
>    Button["Push me",
>     (sw == True;
>      Do[pr == i; Pause[.02];, {i, range[[1]], range[[2]]}];
>      sw == False;), Method -> "Queued"],
>    Dynamic@ProgressIndicator[Dynamic@pr, range],
>    Dynamic@pr,
>    Dynamic@Switch[sw, True, "Calculating...", False, "Finished.", _,
> "Standing by."]
>    }}
> ]
>
>
> Thanks in advance
> Istvan
>


  • Prev by Date: Re: Equals, Less, Greater, etc; Confused by this simple output.
  • Next by Date: Re: Equals, Less, Greater, etc; Confused by this simple
  • Previous by thread: ProgressIndicator inside DynamicModule
  • Next by thread: Re: ProgressIndicator inside DynamicModule