Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Create a new notebook with the following two input cells:

NotebookWrite[EvaluationNotebook[], Cell[BoxData[ToBoxes[Manipulator[Dynamic[x]]]], "Output"]]

and

y = 10  (* dummy cell *)

If you evaluate the whole notebook (Evaluation menu\Evaluate Notebook), you will see the manipulator appear then quickly disappear.

If you manually evaluate the first cell, the manipulator will not disappear.

Why is this happening?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

NotebookWrite print the cell after the selection. Evaluate Notebook select whole notebook and evaluate this. Therefore, your cell is printed in the end of the notebook. Evaluation of the last cell overwrite the output.

You can use CellPrint[...] instead of NotebookWrite[EvaluationNotebook[], ...].

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.