({{, (RefLink[ButtonSource, paclet:ref/ButtonSource])
is an option for the low-level function (RefLink[ButtonBox, paclet:ref/ButtonBox]) that specifies the first argument to give to the (RefLink[ButtonFunction, paclet:ref/ButtonFunction]) for the button when the button is active and is clicked. }})

OpenersNotesSection(Spacer1)Details

The default is (RefLink[ButtonSource, paclet:ref/ButtonSource])->(RefLink[Automatic, paclet:ref/Automatic]).

Possible settings are:

OpenersPrimaryExamplesSection(Spacer1)Examples  (4)

OpenersExampleSection0(Spacer1)Basic Examples  (4)

Create a button that prints out the value of its (RefLink[ButtonData, paclet:ref/ButtonData]):

CellPrint[Cell[TextData[ButtonBox["Click for button data",Evaluator->Automatic,ButtonFunction->(Print[#]&),ButtonSource->ButtonData,ButtonData->"data",Appearance->"DialogBox"]],"Text",FontColor->Blue]]

Click for button data

Create a button that prints out the button contents:

CellPrint[Cell[TextData[ButtonBox["Click for button contents",Evaluator->Automatic,ButtonFunction->(Print[#]&),ButtonSource->ButtonContents,ButtonData->"data"]],"Text",FontColor->Blue]]

Click for button contents

(RefLink[ButtonSource, paclet:ref/ButtonSource])->(RefLink[Automatic, paclet:ref/Automatic]) means the button function acts on (RefLink[ButtonData, paclet:ref/ButtonData]) if it is set:

CellPrint[Cell[TextData[ButtonBox["Click for data or contents",Evaluator->Automatic,ButtonFunction->(Print[#]&),ButtonSource->Automatic,ButtonData->"data"]],"Text",FontColor->Blue]]

Click for data or contents

When (RefLink[ButtonData, paclet:ref/ButtonData]) is not set, (RefLink[ButtonSource, paclet:ref/ButtonSource])->(RefLink[Automatic, paclet:ref/Automatic]) lets the button act on its contents:

CellPrint[Cell[TextData[ButtonBox["Click for data or contents",Evaluator->Automatic,ButtonFunction->(Print[#]&),ButtonSource->Automatic]],"Text",FontColor->Blue]]

Click for data or contents

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Button, paclet:ref/Button])  ▪  (RefLink[ButtonFunction, paclet:ref/ButtonFunction])  ▪  (RefLink[ButtonData, paclet:ref/ButtonData])  ▪  (RefLink[BaseStyle, paclet:ref/BaseStyle])  ▪  (RefLink[NotebookRead, paclet:ref/NotebookRead])}})}})