Re: Capture ESC Key for Dialog in wxEuphoria

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

This seems to work fine for me...

-- 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} ) 
 
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 ) 

-Greg

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

Search



Quick Links

User menu

Not signed in.

Misc Menu