Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / problem using key_down

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. problem using key_down
#3257
Posted by: KaReL 2004-01-19 11:46:14
Well, I have a frame which is 'wxDEFAULT_FRAME_STYLE | wxFRAME_FLOAT_ON_PARENT | wxFRAME_NO_TASKBAR | wxWS_EX_BLOCK_EVENTS | wxNO_FULL_REPAINT_ON_RESIZE'.

Now when I do like this:

  EVT_KEY_DOWN        (                                  Addresses::On_Key_Down)
void Addresses::On_Key_Down( wxKeyEvent& event )
{
  if ( event.GetKeyCode() == WXK_ESCAPE )
  {
    On_Close( wxCommandEvent() );
    event.StopPropagation();
  }
}

This will never get touched, because I'm in my controls in that frame (I checked it out & I was pressing the escape button in a textcontrol).
That's fine by me, but I want it to propagate.

But if I use EVT_CHAR_HOOK. I do get the escape-press. But that is bad, because my accelerator keys of my menus won't work properly :S


Does anyone knows a solution for this?
Thx!

------------------------
Website: www.KaReLs0ft.be
Message2. Re: problem using key_down
#3258
Posted by: upCASE 2004-01-19 20:11:44
Hi!
Have you tried skipping the event after processing it? I mean catch the event for EVT_CHAR_HOOK, process it and if it's not WXK_ESCAPE call event.Skip().
I just tried that and I guess it should work.

upCASE
-----------------------------------
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Message3. Re: problem using key_down
#3261
Posted by: KaReL 2004-01-20 01:03:21
That did the trick ;)

For those interested:

It's because I had this setup:

frame -> tabctrl -> textctrl

propagation is only 1 level default... So only tabctrl was receiving the keydown, not the frame :(

------------------------
Website: www.KaReLs0ft.be
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
¥289.00 ·
 
 
¥1,080.00 ·
 
 
¥1,380.00 ·
 
 
¥638.00 ·
 
 
¥1,290.00 ·
 
 
¥1,420.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0