({{, (RefLink[CancelButton, paclet:ref/CancelButton])[] 
represents a Cancel button in a dialog that closes the dialog window when clicked.}, {, (RefLink[CancelButton, paclet:ref/CancelButton])[action] 
represents a button labeled Cancel that evaluates action when clicked.}, {, (RefLink[CancelButton, paclet:ref/CancelButton])[label,action] 
uses label as the label for the button.}})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[CancelButton, paclet:ref/CancelButton])[] is equivalent to (RefLink[CancelButton, paclet:ref/CancelButton])[(RefLink[DialogReturn, paclet:ref/DialogReturn])[(RefLink[$Canceled, paclet:ref/$Canceled])]].

In dialogs created with (RefLink[DialogInput, paclet:ref/DialogInput]) or (RefLink[CreateDialog, paclet:ref/CreateDialog]), pressing (Key0[esc]) is effectively equivalent to clicking the Cancel button.

If there are several Cancel buttons in a single dialog, (Key0[esc]) will use the first one in the dialog.

(RefLink[CancelButton, paclet:ref/CancelButton]) has the same options as (RefLink[Button, paclet:ref/Button]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (6)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Create dialog input and use (RefLink[CancelButton, paclet:ref/CancelButton]) to cancel the action:

DialogInput[CancelButton[]]

OpenersExampleSection2(Spacer1)Applications  (2)

Create a dialog with both a default button and a cancel button:

DialogInput[{LocatorPane[Dynamic[prim],Framed@Graphics[{},ImageSize->Tiny]],Dynamic[prim],DefaultButton[DialogReturn[prim]],CancelButton[]}]

Create a dialog with a close button:

CreateDialog[{LocatorPane[Dynamic[prim],Framed@Graphics[{},ImageSize->Tiny]],Dynamic[prim],CancelButton["Close",DialogReturn[]]}];

OpenersExampleSection3(Spacer1)Properties & Relations  (3)

(RefLink[CancelButton, paclet:ref/CancelButton]) is a special case of (RefLink[Button, paclet:ref/Button]):

CancelButton[]

Button["Cancel",DialogReturn[$Canceled]]

Create a dialog with a cancel button; the dialog is dismissed by clicking the button or pressing (Key0[esc]):

CreateDialog[CancelButton[]]

Create a dialog that holds evaluations until the dialog is dismissed:

DialogInput[CancelButton[]]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Button, paclet:ref/Button])  ▪  (RefLink[DefaultButton, paclet:ref/DefaultButton])  ▪  (RefLink[ChoiceButtons, paclet:ref/ChoiceButtons])  ▪  (RefLink[DialogReturn, paclet:ref/DialogReturn])  ▪  (RefLink[DialogInput, paclet:ref/DialogInput])  ▪  (RefLink[CreateDialog, paclet:ref/CreateDialog])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Creating Dialog Boxes, paclet:tutorial/CreatingDialogBoxes])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Dialog Boxes, paclet:guide/DialogBoxes])}})}})