Re: Manipulate evaluates repeatedly - how do i stop it
- To: mathgroup at smc.vnet.net
- Subject: [mg91579] Re: [mg91554] Manipulate evaluates repeatedly - how do i stop it
- From: John Fultz <jfultz at wolfram.com>
- Date: Thu, 28 Aug 2008 03:16:46 -0400 (EDT)
- Reply-to: jfultz at wolfram.com
On Wed, 27 Aug 2008 06:42:08 -0400 (EDT), robert prince-wright wrote: > Does anyone know how to stop two Manipulate objects from appearing to re- > evaluate when they are both visble in a Notebook window? > > I have created a two Manipulate objects that display interactive > graphics. Each one is contained in separate output cells which means, in > principle, the variables used inside the Manipulates are Localized. The > names of the sliders are the same in each Manipulate (but that shouldn't > matter?). > > When one Manipulate is visible the RHS Bracket around the cell shows the > normal state for a cell that has been evaluated, however, when you scroll > and both are visible in the notebook window the cell brackets start to > flash with double lines and yellow suggesting the cell is re-evaluating. > > Any ideas on how to stop this? > > Robert Your assumption is not true. Manipulate, at most, localizes only those variables which are attached to controls. Here is a trivial example which recreates the conditions you describe... Manipulate[x = 1; {b, x}, {b, 0, 5}] Manipulate[x = 2; {c, x}, {c, 0, 5}] If you want to localize other variables, you'll have to do this by hand. You could do this by wrapping the Manipulate with a DynamicModule[]. In the above trivial example, it might look like... DynamicModule[{x}, Manipulate[x = 1; {b, x}, {b, 0, 5}]] DynamicModule[{x}, Manipulate[x = 2; {c, x}, {c, 0, 5}]] Of course, this will not inherit the value of x from the outside. If you want to use the value of x at the moment of the Shift+Enter evaluation, you can do... DynamicModule[{x=x}, ...] Sincerely, John Fultz jfultz at wolfram.com User Interface Group Wolfram Research, Inc.