Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #1249
| From | "Miranda, Juan" <juan.miranda@hp.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | InheritScope in CDF player |
| Date | 2011-03-30 09:09 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <imus0p$htd$1@smc.vnet.net> (permalink) |
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
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
InheritScope in CDF player "Miranda, Juan" <juan.miranda@hp.com> - 2011-03-30 09:09 +0000
csiph-web