Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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