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