From Xojo Documentation

Class (inherits from Object)

A button in a MessageDialog box. There are three possible MessageDialogButtons: ActionButton, CancelButton, and AlternateActionButton.

Cancel Default
Caption Visible


By default, only the ActionButton has its Visible property set to True. To show either of the other buttons in a MessageDialog, set their Visible properties.


This example sets Captions of the buttons.

Dim d As New MessageDialog //declare the MessageDialog object
Dim b As MessageDialogButton //for handling the result
d.Icon = MessageDialog.GraphicCaution //display warning icon

d.ActionButton.Caption = "Save"
d.CancelButton.Visible = True //show the Cancel button
d.AlternateActionButton.Visible = True //show the "Don't Save" button
d.AlternateActionButton.Caption = "Don't Save"
d.AlternateActionButton.Cancel = True // sets AlternateAction button to cancel
d.Title = "This is the Title (Windows & Linux)"
d.Message = "Do you want to save changes to this document before closing?"
d.Explanation = "If you don't save, your changes will be lost. "

b = d.ShowModalWithin(Window1) //display the dialog in the window
Select Case b //determine which button was pressed.
Case d.ActionButton
// user pressed Save
Case d.AlternateActionButton
// user pressed Don't Save
Case d.CancelButton
// user pressed Cancel
End Select

See also the examples for MessageDialog.

See Also

MsgBox function; MessageDialog, Window classes.