1. Q: wxEuphoria - key event

winHtml1 and winHtml2 are wxHtmlWindow's
btnHtml is a wxButton on winHtml1

The focus is on winHtml2

Click on the button and both winHtml1 and winHtml2 go away.

How can I do the same thing with a key press, as for example the ESC key?

procedure closeHtml(atom this, atom event_type, atom id, atom event)
  show_window(winHtml1,0)
  show_window(winHtml2,0)
end procedure
set_event_handler({winHtml1,btnHtml}, get_id(btnHtml),
  wxEVT_COMMAND_BUTTON_CLICKED, routine_id("closeHtml")) -- This works.
set_event_handler({frameWin,winHtml2}, get_id(winHtml2),
  wxEVT_CHAR, routine_id("closeHtml"))  -- This does not work.


new topic     » topic index » view message » categorize

2. Re: Q: wxEuphoria - key event

Jerry Story wrote:
> 
> winHtml1 and winHtml2 are wxHtmlWindow's
> btnHtml is a wxButton on winHtml1
> 
> The focus is on winHtml2
> 
> Click on the button and both winHtml1 and winHtml2 go away.
> 
> How can I do the same thing with a key press, as for example the ESC key?
> 
> }}}
<eucode>
> 
> procedure closeHtml(atom this, atom event_type, atom id, atom event)
>   show_window(winHtml1,0)
>   show_window(winHtml2,0)
> end procedure
> set_event_handler({winHtml1,btnHtml}, get_id(btnHtml),
>   wxEVT_COMMAND_BUTTON_CLICKED, routine_id("closeHtml")) -- This works.
> set_event_handler({frameWin,winHtml2}, get_id(winHtml2),
>   wxEVT_CHAR, routine_id("closeHtml"))  -- This does not work.
> 
> </eucode>
{{{


If wxEVT_CHAR doesn't work, try wxEVT_KEY_DOWN.  It might also work with
wxEVT_CHAR, but with id = -1.  -1 means that it won't filter the event
based on the id of the originating control.

Matt Lewis

new topic     » goto parent     » topic index » view message » categorize

3. Re: Q: wxEuphoria - key event

> Jerry Story wrote:
procedure closeHtml(atom this, atom event_type, atom id, atom event)
  show_window(winHtml1,0)
  show_window(winHtml2,0)
end procedure
set_event_handler({winHtml1,btnHtml}, get_id(btnHtml),
  wxEVT_COMMAND_BUTTON_CLICKED, routine_id("closeHtml")) -- This works.
set_event_handler({frameWin,winHtml2}, get_id(winHtml2),
  wxEVT_CHAR, routine_id("closeHtml"))  -- This does not work.
 

 
> If wxEVT_CHAR doesn't work, try wxEVT_KEY_DOWN.  It might also work with
> wxEVT_CHAR, but with id = -1.  -1 means that it won't filter the event
> based on the id of the originating control.
> 
> Matt Lewis

Still doesn't work.

new topic     » goto parent     » topic index » view message » categorize

4. Re: Q: wxEuphoria - key event

Jerry Story wrote:
> 
> > Jerry Story wrote:
> }}}
<eucode>
>  
> procedure closeHtml(atom this, atom event_type, atom id, atom event)
>   show_window(winHtml1,0)
>   show_window(winHtml2,0)
> end procedure
> set_event_handler({winHtml1,btnHtml}, get_id(btnHtml),
>   wxEVT_COMMAND_BUTTON_CLICKED, routine_id("closeHtml")) -- This works.
> set_event_handler({frameWin,winHtml2}, get_id(winHtml2),
>   wxEVT_CHAR, routine_id("closeHtml"))  -- This does not work.>  
> </eucode>
{{{

>  
> > If wxEVT_CHAR doesn't work, try wxEVT_KEY_DOWN.  It might also work with
> > wxEVT_CHAR, but with id = -1.  -1 means that it won't filter the event
> > based on the id of the originating control.
> > 
> > Matt Lewis
> 
> Still doesn't work.

It will likely be something like 

 KeyIs = get_key_code (event)
 if keyIs = ? then...

You'll need to reassign the ? to the key ID of the ESC or whatever key you 
might want.(Should be 27 for the ESC if not, see the Documentation) If you 
need more help, try looking into the catch_keys.exw demofrom the wxEuphoria 
demo's since that's where I got that snippet from.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu