Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Dynamic Interactivity > Custom Interface Construction > Dialog Boxes >

DefaultButton

DefaultButton[]
represents an OK button that closes a dialog, and is the default when Enter is pressed in the dialog.
DefaultButton[action]
represents a button that is labeled OK, and whose action is to evaluate action.
DefaultButton[label, action]
uses label as the label for the button.
  • In dialogs created with DialogInput or CreateDialog, pressing Enter is effectively equivalent to clicking the OK button.
  • If there are several default buttons in a single dialog, Enter will use the first one in the dialog.
Create dialog input, and use DefaultButton to dismiss dialog:
Create dialog input, and use DefaultButton to dismiss dialog:
Create a dialog with a Locator, and return the last location:
DefaultButton is a special case of Button:
Create a dialog with an OK button; the window is dismissed with a click or Enter:
Create a dialog that holds evaluations until the dialog is dismissed:
New in 6
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team