This is documentation for Mathematica 4, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
Wolfram Research, Inc.

Displaying and Printing Mathematica NotebooksSetting Up Hyperlinks

1.10.12 Creating Your Own Palettes

The Mathematica 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 item Generate Palette from Selection makes a separate active palette.

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

Menu items 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 ControlKeyLeftModified,RightModified will add a new column of buttons, and ControlKeyLeftModifiedRightModified (Control-Return) will add a new row.

Contents of buttons.

In the simplest case, when you press 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 press 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.

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

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

Typical actions for buttons.

With the default Paste setting for a button action, pressing the button modifies the contents of a cell but does no evaluation. By choosing other button actions, however, you can tell Mathematica to perform an evaluation every time you press 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 which modifies parts of an expression in place, say 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 pressing 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, then 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 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 which 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 kernel, or changing the configuration of notebooks in the front end. Section 2.10.6 discusses how to do this.

Displaying and Printing Mathematica NotebooksSetting Up Hyperlinks