I have a MessageDialog loaded in my window Closing event. This has Save as the ActionButton, Don’t Save as the AlternateActionButton and a Cancel button. Save triggers a save to disk, Don’t Save does nothing (and the window, and the application, closes). These are working as expected. I would like the Cancel button to dismiss the MessageDialog and allow the user to continue with the program, but I cannot see how to do this. Instead it closes the window and the application (just like the AlternateActionButton).
Is there a way to cancel the window closing event?
// Window.CancelClose
Var Dialog As New MessageDialog
// Do all your setup
Var Choice As MessageDialogButton = Dialog.ShowModal(Self)
Select Case Choice
Case Dialog.ActionButton
// Save
Case Dialog.AlternateActionButton
// Don't Save
Else
// Cancel or closed
Return True
End Select
You could skip assigning the button to a variable of course, but this makes it easier to see in the debugger and I think looks cleaner.