Message Boards Message Boards

2
|
15257 Views
|
8 Replies
|
7 Total Likes
View groups...
Share
Share this post:

How to suppress display of input source in a displayed cdf file?

Posted 12 years ago
Here's an easy one?

How do I supress the Manipulate statement and code and just show the output graphics in the cdf.
I'm using the browser plug in route. 

http://www.dialbohm.org/wrcs/test1.html
POSTED BY: William Stewart
8 Replies
You can copy your manipulate cell into a new notebook and deploy that.

Or programmatically, you can do something like this:
CreateDocument[ Manipulate[x,{x,0,1}] ]
and deploy that.

Or more directly, use the CDFDeploy function:
CDFDeploy["test.cdf", Manipulate[x, {x, 0, 1}]]

Here is an example of how that ends up looking (with my added html surround code):
http://members.wolfram.com/arnoudb/test.html

http://reference.wolfram.com/mathematica/ref/CreateDocument.html

http://reference.wolfram.com/mathematica/ref/CDFDeploy.html
POSTED BY: Arnoud Buzing
Posted 11 years ago

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

POSTED BY: Hamish Small

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:

Module[{nb, nbg,},
 nb = EvaluationNotebook[];
 nbg = NotebookGet[nb];
 nb = NotebookPut[nbg];
 NotebookFind[nb, "Input", All, CellStyle];
 NotebookDelete[nb]
 ]

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.

POSTED BY: David Reiss

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 ...

POSTED BY: William Stewart
Posted 11 years ago

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.

Attachments:
POSTED BY: Hans Milton
Posted 11 years ago

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.

POSTED BY: Hamish Small
Posted 11 years ago

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.

POSTED BY: Hamish Small
Posted 11 years ago

Good to hear Hamish. And, in my experience, it is a very practical and robust method.

POSTED BY: Hans Milton
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract