Re: Initialization Cells Not Evaluated When Notebook Saved to CDF
- To: mathgroup at smc.vnet.net
- Subject: [mg124756] Re: Initialization Cells Not Evaluated When Notebook Saved to CDF
- From: Gregory Lypny <gregory.lypny at videotron.ca>
- Date: Sat, 4 Feb 2012 06:30:15 -0500 (EST)
- Delivered-to: firstname.lastname@example.org
Thank you, John. Much appreciated. I was on my way to discovering as much yesterday as I worked on a fix that involved moving key variables into a Manipulate that has SaveDefinitions set to True. I'm going to explore your other suggestions. Regards, Gregory On Fri, Feb 3, 2012, at 11:34 AM, John Fultz 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 > jfultz at wolfram.com > User Interface Group > Wolfram Research, Inc.