Buttons with Graphics
A new feature for Mathematica 4 is the ability to put any
Cell expression on the face of a button. This means that anything you can create in a cell (such as graphics) can appear on your buttons.
To put this graph on the button, you first need to know how to generate the
Cell expression for the graph. This is done with the
This string is placed inside a
Cell expression. The first argument of
Cell indicates that the cell is PostScript
GraphicsData. The second argument is the cell style
Graphics. Additional arguments are
This cell is embedded in another cell which creates the button. The first argument is the
ButtonBox. The first argument of the
ButtonBox is the graphics cell. The rest are options of the button. The second argument, again, is the cell style of the button cell. Additional arguments are any options of the button cell, including the action of the button (e.g.,
Now that we have all the parts, we can write the cell to the front end with
We then can apply this function to any graphics. (
DisplayFunction->Identity suppresses the normally generated graphics.)
The same can be done by using the
DisplayFunction option when generating graphics.
Clicking on either of the above buttons will create a new notebook with an animated moebius strip.
Converted by Mathematica
October 8, 1999