Re: Capture ESC Key for Dialog in wxEuphoria
- Posted by EUWX Jun 20, 2012
- 1541 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.
-- key_test.exw include "wxeu/wxeud.e" constant frmMain = create( wxFrame, {0, -1, "Key Test", -1, -1, 480, 360} ) constant pnlMain = create( wxPanel, {frmMain} ) constant btnShow = create( wxButton, {pnlMain, -1, "&Show dialog", 10, 10, 75, 23} ) constant dlgDialog = create( wxDialog, {0, -1, "Dialog", -1, -1, 640, 480} ) constant testbttn = create( wxButton, {dlgDialog,-1,"OK",-1,-1,-1,-1} ) procedure btnShow_onClick( atom this, atom event_type, atom id, atom event ) show_modal( dlgDialog ) end procedure set_event_handler( btnShow, -1, wxEVT_COMMAND_BUTTON_CLICKED, routine_id("btnShow_onClick") ) procedure dlgDialog_onKeyDown( atom this, atom event_type, atom id, atom event ) atom keyCode = get_key_code( event ) if keyCode = WXK_ESCAPE then end_modal( this, wxID_CANCEL ) end if skip( event ) end procedure set_event_handler( dlgDialog, -1, wxEVT_KEY_DOWN, routine_id("dlgDialog_onKeyDown") ) wxMain( frmMain )
It seems that esc key is set to beep. I have had problems with
skip( event )
Perhaps the gurus can explain its use whilst they are solving your problem.