Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Re: Initialization Cells Not Evaluated When Notebook Saved to CDF

  • To: mathgroup at smc.vnet.net
  • Subject: [mg124776] Re: Initialization Cells Not Evaluated When Notebook Saved to CDF
  • From: David Reiss <dbreiss at gmail.com>
  • Date: Sun, 5 Feb 2012 06:03:21 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jgj4ud$mva$1@smc.vnet.net>

I really need to review the list of functions that are new in version
8.  I hadn't been aware of the NotebookDynamicExpression function and
related ones.  And the approach that you describe to execute code upon
opening a notebook serves to complement the lack of a "WindowOpen"
event for the NotebookEventActions -> "WindowClose" event.  So this
then begs the question of why there isn't a "WindowOpen" event
defined.  Just curious....

Thanks!
--David


On Feb 4, 6:31 am, John Fultz <jfu... at wolfram.com> wrote:
> 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
> jfu... at 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




  • Prev by Date: Front end won't start on win7 64
  • Next by Date: Formatting Input cell comments
  • Previous by thread: Re: Initialization Cells Not Evaluated When Notebook Saved to CDF
  • Next by thread: Re:Function Doesn't Evaluate Local Variables?