1. Use CreatePalette[expr] to generate palettes:
cp[] := CreatePalette[Button["Create Palette", cp[]]]
cp[]
That way you have access to the code to generate a palette and you can
modify that to make changes to your palette.
2. Under the 'Palettes' menu, there is a 'Generate Notebook from
Palette'. After using this on a (selected) palette, you can then
look at the underlying cell expression with the Cell -> Show Expression
menu item.
3. Assign the palette notebook object to a variable like so:
nb = cp[]
And then traverse the notebook expression to the BoxData and call
MakeExpression on it:
MakeExpression[NotebookGet[nb][[1, 1, 1]], StandardForm] // FullForm
--
Arnoud
On 8/22/10 7:10 AM, Murray Eisenberg wrote:
> If I have a palette notebook already created, how can I open it in a way
> that I (1) see the underlying expressions; and (2) can select in a
> syntax-aware manner, just like you can with input expressions in an
> ordinary notebook?
>
> Is there some way in Mathematica itself?
>
> In Workbench? If so, how do you open the palette notebook there that way?
>
--
Murray Eisenberg mur...@math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305
Button["SelectionMoveAllExpression", SelectionMove[EvaluationNotebook[],
All, Expression]]
But sometimes something is fishy with SelectionMove. Let us create four
additional buttons:
Button["SelectionMoveBeforeExpression",
SelectionMove[EvaluationNotebook[], Before, Expression]]
Button["SelectionMoveAfterExpression",
SelectionMove[EvaluationNotebook[], After, Expression]]
Button["SelectionMovePreviousExpression",
SelectionMove[EvaluationNotebook[], Previous, Expression]]
Button["SelectionMoveNextExpression",
SelectionMove[EvaluationNotebook[], Next, Expression]]
I have tested them on the expression
Sin[x] + Cos[y]
The first button, "SelectionMoveAllExpression", works as expected. To me it
seems a bit counterintuitive that a single bracket "[" is an expression, but
for Mathematica "everything is an expression", so OK with that.
The button "SelectionMoveBeforeExpression" also seem okey, unless the cursor
is placed after the letter "i" in Sin. Then the cursor is just moved to the
position after S. Is "i" in "Sin" an expression?
The button "SelectionMoveAfterExpression" does not do anything at all, while
the button "SelectionMoveNextExpression" does the job that
"SelectionMoveAfterExpression" should have done, with a similar behavior
inside words as "SelectionMoveBeforeExpression".
And the button "SelectionMovePreviousExpression" does exactly the same job
as "SelectionMoveBeforeExpression".
In the tutorial " Manipulating Notebooks from the Kernel" the word
"Expression" is said to mean "complete subexpression".
Can someone be pedagogic and help me in my ignorance?
Best regards
Ingolf Dahl