Legacy Documentation

Mathematica® Teacher's Edition (2002)

This is documentation for an obsolete product.
Current products and services
 Documentation /  Mathematica Teacher's Edition /  The Teacher's Book /  Basic Calculations /  Input and Output in Notebooks /

11.12 Creating Your Own Palettes

The Mathematica TE notebook front end comes with a collection of standard palettes. But it also allows you to create your own palettes.

The basic steps in creating a palette.

Create Table/Matrix/Palette will create a blank palette.

You can then insert whatever you want into each button.

The menu command Generate Palette from Selection makes a separate active palette.

Clicking on a button in the palette now inserts its contents into your notebook.

Menu commands for setting up palettes.

When you are creating a palette, you can use the same mechanisms to add columns and rows as you can when you are creating any other kind of table, matrix or grid. Thus ControlKey LeftModified ,RightModified will add a new column of buttons, and ControlKey LeftModified RightModified (Control-Return) will add a new row.

Contents of buttons.

In the simplest case, when you click a button in a palette what will happen is that the contents of the button will be inserted into your notebook, replacing whatever your current selection was.
Sometimes however you may not simply want to overwrite your current selection, but rather you may want to modify the selection in some way. As an example, you might want to wrap a function like Expand around your current selection.
You can do this by setting up a button with contents Expand[]. The can be entered as AliasIndicatorsplAliasIndicator or \[SelectionPlaceholder]. In general, serves as a placeholder for your current selection. When you click a button that contains , the is first replaced by your current selection, and only then is the result inserted into your notebook.

Here is a cell in which the current selection is part of an expression.

Clicking a button containing Expand[] wraps Expand around the current selection.

Mathematica TE allows you to associate any action you want with a button. You can set up some common actions by using the Edit Button submenu, having selected either a single button or a whole palette.

Typical actions for buttons.

With the default Paste setting for a button action, clicking the button modifies the contents of a cell but does no evaluation. By choosing other button actions, however, you can tell Mathematica TE to perform an evaluation every time you click the button.
With the button action Evaluate the result of this evaluation is made to overwrite your current selection. This is useful if you want to set up a button that modifies parts of an expression in place, for example, by applying Expand[] to them.
The button action Evaluate performs evaluation only on whatever was pasted into your current cell. The button action EvaluateCell, on the other hand, performs evaluation on the whole cell, generating a new cell to show the result.

Here is an expression with a part selected.

This shows the result of clicking a button containing Expand[] with an EvaluateCell button action.

Sometimes it is useful to be able to extract the current selection from a cell, and then operate on it in a new cell. You can do this using the button actions CopyEvaluate and CopyEvaluateCell.

Here is an expression with a part selected.

A button with a CopyEvaluateCell button action copies the current selection into a new cell, pastes the contents of the button, and then performs an evaluation, putting the result into a new cell.

Ways to create active elements in the front end.

Mathematica TE allows you to set up a wide range of active elements in the notebook front end. In the most common case, you have a palette that consists of an array of buttons in a separate window. But you can also have arrays of buttons, or even single buttons, within the cells of an ordinary notebook.
In addition, you can make a button execute any action you want--performing computations in the Mathematica TE kernel, or changing the configuration of notebooks in the front end.