This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

Documentation / Mathematica / The Mathematica Book / A Practical Introduction to Mathematica / Using the Mathematica System /

1.3.6 Active Elements in Notebooks

One of the most powerful features of Mathematica notebooks is that their actions can be programmed. Thus, for example, you can set up a button in a Mathematica notebook which causes various operations to be performed whenever you click it.

Here is a notebook that contains a button.

Clicking the button in this case causes the current date to be displayed.

Later in this book, we will discuss how you can set up buttons and other similar objects in Mathematica notebooks. But here suffice it to say that whenever a cell is indicated as active, typically by the presence of a stylized "A" in its cell bracket, clicking on active elements within the cell will cause actions that have been programmed for these elements to be performed.

It is common to set up palettes which consist of arrays of buttons. Sometimes such palettes appear as cells within a notebook. But more often, a special kind of separate notebook window is used, which can conveniently be placed on the side of your computer screen and used in conjunction with any other notebook.

Palettes consisting of arrays of buttons are often placed in separate notebooks.

In the simplest cases, the buttons in palettes serve essentially like additional keys on your keyboard. Thus, when you press a button, the character or object shown in that button is inserted into your notebook just as if you had typed it.

Here is a palette of Greek letters with buttons that act like additional keys on your keyboard.

Often, however, a button may contain a placeholder indicated by . This signifies that when you press the button, whatever is currently selected in your notebook will be inserted at the position of the placeholder.

The buttons here contain placeholders indicated by .

Here is a notebook with an expression selected.

Pressing the top left button in the palette wraps the selected expression with a square root.

Sometimes buttons that contain placeholders will be programmed simply to insert a certain expression in your notebook. But more often, they will be programmed to evaluate the result, sending it as input to the Mathematica kernel.

These buttons are set up to perform algebraic operations.

Here is a notebook with an expression selected.

Pressing the top left button in the palette causes the selected expression to be simplified.

There are some situations in which it is convenient to have several placeholders in a single button. Your current selection is typically inserted at the position of the primary placeholder, indicated by . Additional placeholders may however be indicated by , and you can move to the positions of successive placeholders using Tab.

Here is a palette containing buttons with several placeholders.

Here is an expression in a notebook.

Pressing the top left button in the palette inserts the expression in place of the .

You can move to the other placeholders using Tab, and then edit them to insert whatever you want.