Re: Capture ESC Key for Dialog in wxEuphoria

new topic     » goto parent     » topic index » view thread      » older message » newer message

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 ) 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu