QuestionDlg doesn't always return mrCancel when Escape key is pressed
Original Reporter info from Mantis: kluug.net @onpok
-
Reporter name: Ondrej Pokorny
Original Reporter info from Mantis: kluug.net @onpok
- Reporter name: Ondrej Pokorny
Description:
If you press the Escape key or click on dialog close button in QuestionDlg, there is different behavior in different WS:
- Win32, Gtk2, Qt: ModalResult of one of the buttons is returned (in this order: mrCancel, mrAbort, mrNo, mrIgnore, mrNoToAll, mrYes, mrOk, mrRetry, mrAll, mrYesToAll). Yes even mrYes is possible!!!
- Carbon: always mrCancel
Wanted: always mrCancel
Steps to reproduce:
See the attached example project for a self-contained example. Hit "Escape" or close the dialog with the close button. Wanted result is "mrCancel".
---
Real-life example:
1.) start building the IDE (or a big app) in Lazarus and run "compile" again.
2.) The dialog "The IDE is still building" appears.
3.) Press "Escape".
4.) Building will be aborted !!! Instead, building should continue !!!
---
(Obviously, the above steps-to-reproduce show wrong behavior only on Win32/Gtk2/Qt. Carbon behaves the way I want it even without the patch.)
Additional information:
Possible patch attached. Please review and comment if you have objections.
I tested:
Win32, Gtk2, Qt, Carbon -> the new behavior is the consistent now. If the user hits "Escape" or closes the dialog with the close button, mrCancel is always returned.
Mantis conversion info:
- Mantis ID: 28988
- Build: trunk
- Version: 1.5 (SVN)
- Fixed in version: 1.6
- Fixed in revision: 50369 (#b264b1d9)
- Monitored by: » @flyingsheep (Bart Broersma)