Hello William, I am trying to develop some interactive tutorials where I provide the student with some textual background in a Mathematica CDF followed by interactive examples. But I would like to suppress (hide) all the code, mainly because the product looks less messy if it is not cluttered up with a lot of stuff that the student does not require. Sounds as if you have already accomplished that from the example you give. Can you please tell me how I can accomplish what I want to do or at least direct me to the part of the Documentation Center that deals with this sort of issue. It must turn up quite a lot. Thanks
I am struggling with the general approach to this myself Hamish!
I have done some experimenting setting up string variables then just displaying them using the techniques above to suppress source code display.
At the moment it seems all the text in the text variables has to be in the source code as you cannot load files from cdf.
Maybe the new cloud computing will completely transform this though?
Over to the experts ...
One way to do this generally for a full notebook is to (on a Mac) is first to create a duplicate of your notebook. Then Option-click on the cell bracket of an input cell--this selects all Input cells. You can then delete all in the selected input cells and save the new notebook and/or export it as a CDF.
Another way to programmatically do this is, in the original notebook, paste in the following code and then execute it:
nb = EvaluationNotebook;
nbg = NotebookGet[nb];
nb = NotebookPut[nbg];
NotebookFind[nb, "Input", All, CellStyle];
This will create a new notebook from the original one with all the Input cells deleted. Of course you need to have executed the original input cells in the original notebook before executing this code in it.
I enclose a description of a method that works for me. When creating a CDF that contains a Manipulates output only. And not the source code. The example is from v10, but it works equally well in v9.
After digesting your various helpful suggestions I have developed the following plan:
1. Create and save a notebook that I will call the Tutorial Master Notebook. This will eventually become the final product, theTutorial.
2. Create a first Working Notebook in which I will develop code to execute an interactive example ("the experiment"). When I am satisfied that the code is working properly, I will copy just the cell containing "the experiment" and insert it into the Tutorial Master Notebook. I will then open another notebook, Working Notebook #2, and develop another experiment and repeat the process of copying and inserting. And so on.
3. At any point in the development of the Tutorial, I may deploy the Tutorial Master Notebook as a CDF and, if it works as planned, save it as Version 1,2 etc until the final version is reached.
There are evidently more elegant programmatic ways of accomplishing what I am after, but since i am a novice in Mathematica my plan is the most easily do-able at the moment. Perhaps it will be useful to others.
Hans, looks like my plan is the same as the procedure you used in your example. I have tried it and it works in the way that I wanted.
Good to hear Hamish. And, in my experience, it is a very practical and robust method.