MathGroup Archive 2007

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

Search the Archive

RE: Button on a palette to create new text cells

  • To: mathgroup at smc.vnet.net
  • Subject: [mg77975] RE: [mg77967] Button on a palette to create new text cells
  • From: "Ingolf Dahl" <ingolf.dahl at telia.com>
  • Date: Thu, 21 Jun 2007 05:27:54 -0400 (EDT)
  • References: <200706200945.FAA10630@smc.vnet.net>
  • Reply-to: <ingolf.dahl at telia.com>

Try

CreatePalette[{Button["New Text Cell", 
   NotebookWrite[InputNotebook[], Cell["", "Text",
      FontFamily -> "Helvetica",
      FontSize -> 36,
      FontWeight -> "Plain",
      FontSlant -> "Plain",
      Background -> RGBColor[1, 0.8, 1]]]]}, 
 WindowTitle -> "Text Cell Creator"]

Best regards

Ingolf Dahl

-----Original Message-----
From: Donald DuBois [mailto:donabc at comcast.net] 
Sent: 20 June 2007 11:46
To: mathgroup at smc.vnet.net
Subject: [mg77975] [mg77967] Button on a palette to create new text cells

I am trying to create a palette that has a button
on it which, when clicked, will create a new text cell
right under the cursor in the selected notebook and this cell will have a
given background color, font family and font size.   The closest I have
been able to get to this goal are the following
lines:

CreatePalette[
 {
  
  Button["New Txt Cell", FrontEndExecute[FrontEndToken[SelectedNotebook[],
"SimilarCellBelow"]]]
  
  }
 ]

This creates a new cell which I hoped to be able to modify to
be of Style "Text" with a given background color, font family and size but
have not been able to do so.
The style stays the same as the previous cell - whatever that may have been
- and I don't seem to be able to change that.

There is no token other than "SimilarCellBelow" that I have found that seems
capable of generating a new cell
which is why I am trying to modify what it does.

The general application is to be able to easily add text cells for comments
in a notebook without having to select the cell, and go to the Format pull
down menu 
and then click on a style.

Any suggestions would be creatly appreciated.

Don





  • Prev by Date: Re: copying values of entries between matrices
  • Next by Date: Re: Problem with PlotLegend in Mathematica 6.0
  • Previous by thread: Button on a palette to create new text cells
  • Next by thread: Re: Button on a palette to create new text cells