Re: Capture ESC Key for Dialog in wxEuphoria
- Posted by mattlewis (admin) Jun 20, 2012
- 1530 views
euphoric said...
Using Windows 7, when I run the below code and get the dialog, when I press "ESC," it gives me a system beep sound and the dialog remains.
You must be testing with something other than Windows 7.
constant testbttn = create( wxButton, {dlgDialog,-1,"OK",-1,-1,-1,-1} )
Here on Linux it seems to work correctly. However, I notice that you're allowing wxWidgets to create IDs for your buttons. In fact, there are special IDs predefined for dialog buttons: wxID_OK and wxID_CANCEL.
You might get better results if you use those. For instance, with the OK button, clicking on it causes it to close the modal dialog. Adding a wxID_CANCEL button might keep the automatic cancel behavior that (I think) you're looking for.
Matt