[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple-button Message boxes not behaving according to documentation


Il 15/07/24 22:27, Gianluigi ha scritto:
Il 15/07/24 21:36, T Lee Davidson ha scritto:
The documentation states:
[quote]
The last button is always assumed to be the cancel and the default
button.

This is the same button that is triggered when you close the message box
with the ESCAPE key.

In other words, the default action should always do nothing.
[/quote]

However, given the following code in a Qt5 graphical application:
[code]
Public Sub Form_Close()

   If Message.Question("Are you sure you wish to quit.", "Yes",
"Cancel") = 2 Then Stop Event

End
[/code]

The default button is the first one. It is shown highlighted and is
activated when Return/Enter is pressed.
The Esc button activates the Cancel button as expected.


Hi Lee

and so:

Public Sub Form_Close()

   Message.DefaultButton = False
   If Message.Question("Are you sure you wish to quit.", "Yes",
"Cancel") = 2 Then Stop Event

End

Regards
Gianluigi



The mess was made when the functioning of message was changed compared
to before.
The default wiki instead says that the default button is always the first...

Regards
Gianluigi