NotebookWrite Output Cells That Will Delete from Menu?
- To: mathgroup at smc.vnet.net
- Subject: [mg91551] NotebookWrite Output Cells That Will Delete from Menu?
- From: "David Park" <djmpark at comcast.net>
- Date: Wed, 27 Aug 2008 06:41:33 -0400 (EDT)
I would like to define a Button that will generate a predefined Output cell
display. I would then like to put this Button as an Inline cell in a Text
cell so that I can generate the Output display from the Text cell. I can do
all that.
But I would also like to have it such that if I used the Menu item:
Cell/Delete All Output, the generated cell would be deleted. I find that if
the Button is in an Output cell, or copied into an Input cell, the Menu
delete will work, but it will not work if it is in an Inline cell within a
Text cell. How can I make the FrontEnd Delete All Output work for cells
generated from an Inline cell?
Here is an example:
testOutput = Plot[Sin[x], {x, 0, 2 Pi}];
Button["Sin Plot",
SelectionMove[InputNotebook[], After, Cell];
NotebookWrite[InputNotebook[],
Cell[BoxData[ToBoxes[testOutput]], "Output", GeneratedCell -> True,
Deletable -> True]]]
If I evaluate the resulting output Button and use the Menu item Cell/Delete
All Output, the above generated output will delete. Now I copy and paste the
Sin Plot button into a Text cell.
Here is the button copied into a Text cell. (Copy and paste the generated
Button here as an Inline Cell) When I put the cursor outside the Inline cell
and press the button I obtain the 'Sin Plot' as an Output cell. But when I
use the Menu item Cell/Delete All Output it won't delete. Is there a way I
can arrange it so it will delete.
David Park
djmpark at comcast.net
<http://home.comcast.net/~djmpark> http://home.comcast.net/~djmpark