MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: NotebookWrite Output Cells That Will Delete from Menu?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg91568] Re: [mg91551] NotebookWrite Output Cells That Will Delete from Menu?
  • From: John Fultz <jfultz at wolfram.com>
  • Date: Thu, 28 Aug 2008 03:14:41 -0400 (EDT)
  • Reply-to: jfultz at wolfram.com

Mathematica determines whether a cell is an "output" cell by checking to see if 
it has GeneratedCell->True *and* whether it is preceded by an unbroken chain of 
GeneratedCell->True cells immediately preceded by a cell with Evaluatable->True.

Your button is performing identically whether it's in an inline cell or an 
Output cell.  But it performs differently based upon where the resulting cell 
was pasted.

Sincerely,
 
John Fultz
jfultz at wolfram.com
User Interface Group
Wolfram Research, Inc.

On Wed, 27 Aug 2008 06:41:33 -0400 (EDT), David Park wrote:
> 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




  • Prev by Date: Re: efficiently adding many 2D Gaussians
  • Next by Date: Re: problem with using external functions
  • Previous by thread: NotebookWrite Output Cells That Will Delete from Menu?
  • Next by thread: More Convenient Closed Input Cells?