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

ButtonFunction

ButtonFunction
is an option for the low-level function ButtonBox which specifies the function to execute when the button is active and is clicked.
  • The default setting for ButtonFunction causes the button to paste its contents at your current notebook selection.
  • ButtonFunction is used only with the setting Enabled->True either for the individual button, or for the cell which contains it.
  • With ButtonFunction->f the first argument supplied to f is specified by the setting for ButtonSource, and the second argument by the setting for ButtonData.
  • Standard Mathematica precedence rules require parentheses in ButtonFunction->(body&).
  • With the default setting Evaluator->None the expression constructed from the button function is sent to the front end for evaluation.
Create a button that opens a new notebook when pressed:
In[1]:=
Click for copyable input
 
The same thing using a Mathematica kernel function:
In[1]:=
Click for copyable input
New in 3