Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #8330

Re: Initialization Cells Not Evaluated When Notebook Saved to CDF

From John Fultz <jfultz@wolfram.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Initialization Cells Not Evaluated When Notebook Saved to CDF
Date 2012-02-04 11:31 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jgj4ud$mva$1@smc.vnet.net> (permalink)

Show all headers | View raw


Actually, I'll bet that it does *not* work in Mathematica.  Which is to say that if you do nothing more than open the CDF file in a freshly started session of 
Mathematica, you'll get the same breakages.

CDF files which you expect to deploy cannot rely on Shift+Enter evaluations to 
prime the pump.  You need to make sure that all of the code dependencies are in 
the dynamic evaluations somewhere.  Some possible ways of doing this, all of
which have been discussed at various points on MathGroup, include:

* Using the Initialization option of Dynamic, DynamicModule, or Manipulate
* Using the SaveDefinitions option of Manipulate
* Adding code to the NotebookDynamicExpression option of the notebook (if it's 
initialization code, then wrapped in Refresh[#,None]& to prevent it from 
evaluating more than once per session).
* Not such a good idea for function definitions, but if you simply have code
that needs to run before Dynamic code runs, nesting a DynamicWrapper around it 
might be appropriate, too.

Sincerely,

John Fultz
jfultz@wolfram.com
User Interface Group
Wolfram Research, Inc.

On Fri, 3 Feb 2012 02:11:15 -0500 (EST), Gregory Lypny wrote:
> Hello everyone,
>
> I've saved a notebook to CDF.  It has a number of initialization
> cells.  The functions and values of the variables that have been
> initialized are then used or displayed in other cells that make use of
> Dynamic[].  The notebook works fine when opened in Mathematica but in
> the CDF Player, most of the cells with results display errors because
> functions and variables have not been initialized.  What am I doing
> wrong?
>
> Gregory

Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Re: Initialization Cells Not Evaluated When Notebook Saved to CDF John Fultz <jfultz@wolfram.com> - 2012-02-04 11:31 +0000
  Re: Initialization Cells Not Evaluated When Notebook Saved to CDF David Reiss <dbreiss@gmail.com> - 2012-02-05 11:04 +0000

csiph-web