Mathematica 8 is now available

The Interactive Interface

Buttons

The most important attribute of a button is the button function. This dictates what the button will do.

The button can do what it does directly in the FE, or by calling the kernel; be aware of what is happening where.

Evaluating in the front end is equivalent to the setting
ButtonEvaluator->None.

[Graphics:../Images/Novak_FEProgramming_gr_50.gif]

[Graphics:../Images/Novak_FEProgramming_gr_51.gif]

[Graphics:../Images/Novak_FEProgramming_gr_52.gif]

So, if the button operation can be expressed as a sequential series of front-end operation involving notebooks with symbolic names (ButtonNotebook, InputNotebook, etc.), evaluation can occur entirely in the front end. If any variables need to be used, flow control is required, or more complex computations are needed, evaluation must occur in the kernel, calling back to the FE as appropriate.

The button function is more general; it accepts arguments which can be passed to the function. In the simplest form, the first argument is the contents of the button, unless the button data is set, in which case that is used instead.

[Graphics:../Images/Novak_FEProgramming_gr_53.gif]

[Graphics:../Images/Novak_FEProgramming_gr_54.gif]

Another gotcha; I couldn't say ButtonFunction :> Print above; substitution is done in the FE, which doesn't support full range of kernel interpretation.

[Graphics:../Images/Novak_FEProgramming_gr_55.gif]

A Small Applet

Polyhedron Explorer