MathGroup Archive 2011

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

Search the Archive

InheritScope in CDF player

  • To: mathgroup at smc.vnet.net
  • Subject: [mg117701] InheritScope in CDF player
  • From: "Miranda, Juan" <juan.miranda at hp.com>
  • Date: Wed, 30 Mar 2011 04:09:51 -0500 (EST)

Hi everyone,

I am dealing with an application in Mathematica where I want to have a CDF file, where in the main notebook I create a secondary notebook that controls parameters of the main notebook. In order to implement it I used the InheritScope property of DynamicModule. The toy code is the next:

DynamicModule[{x},
x=0;
Grid[{{
Button["NewNotebook",CreateDocument[DynamicModule[{},Grid[{{Button["x+1",x=x+1],Dynamic[x]}}] ,InheritScope->True]]], Button["x+1",x=x+1],
Dynamic[x]}}]
]

In this case, in the main notebook appear two buttons, the second one x+1, just increases the value of x, the first one NewNotebook opens a new notebook that can change the value of "x" in the main notebook (And that belongs to the parent DynamicModule). The important thing in the implementation is when I save the file as a normal notebook and the reopen it in a new Kernel session, when I pressed the NewNotebook button, the connection between the x on the main notebook and the x in the secondary notebook remains. But when I have the same document saved as a CDF file, and the open it with CDF player, whenever I click the x+1 button in the main notebook the x in the main notebook is increased as expected, when I click the NewNotebook button, effectively a new window is created, but it loses all the Dynamic properties.

Can the example be programmed in order to work in CDF player?

Best

Juan Miranda


  • Prev by Date: Re: About C[i]
  • Next by Date: Re: Fit Gaussian function to histogram
  • Previous by thread: Re: Bloch Equation, NDSolve, and strange behaviors
  • Next by thread: Problems with FindMinimum