MessageDialog keyboard TAB - default button always fires

https://documentation.xojo.com/api/language/me.htmlssageDialog
Am I doing something wrong? The other buttons hi-lite upon pressing TAB but never fire on pressing the Enter key. Works via mouse click.

Var d As New MessageDialog                     // declare the MessageDialog object
Var b As MessageDialogButton                   // for handling the result
d.IconType = MessageDialog.IconTypes.Caution   // 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.Message = "Use TAB to navigated to the button and press enter."
d.Explanation = "Though the correct button is highlited " + Chr(13) + Chr(10) + _
"The default button is the one that fires. "

b = d.ShowModal                               // display the dialog
Select Case b                                 // determine which button was pressed.
Case d.ActionButton
  // user pressed Save
  MessageBox("user pressed save")
  
Case d.AlternateActionButton
  // user pressed Don't Save
  MessageBox("user pressed Don't save")
  
Case d.CancelButton
  // user pressed Cancel
  MessageBox("user pressed cancel")
  
End Select

Use the Space Bar to activate highlighted buttons, while enter always activates the default button, like escape always activates the Cancel button.

Hmmm… ok. BUT the rest of the gui already responds to the TAB and ENTER keys. So I’m wondering if there is a way to make the dialog box accept the ENTER key for the button that is high-lighted?

Yes if it is the default button, no otherwise… IMHO

Did you try to press keys (Esc, Tab, Enter, fn+, etc…) ?

That’s not how dialogs work. You could build your own dialog-like window, though, and make it work however you want it to.

1 Like

Ah yes. I did that years ago and forgot that’s how I solved the issue before.
Thanks
Ben