Capturing keys

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
KaReL
Experienced Solver
Experienced Solver
Posts: 78
Joined: Mon Aug 30, 2004 8:52 am
Contact:

Capturing keys

Post by KaReL » Mon Jun 20, 2005 12:07 pm

Hi,

I just wanted to capture all keys on a wxDialog...
I tried both with EVT_CHAR and EVT_CHAR_HOOK. This captures all the
'special keys' fine (the ones in wxKeyCode).

But it does NOT capture default keys like 'A', 'B', 'C', etc...

If I change the baseclass to wxFrame it captures them correctly...

Is this intended behaviour or a bug?


BTW, I am using wxDialog because of the auto-background fill (no need of a
wxPanel) and because of the ShowModal() thing (extremely usefull).
wxWidgets: SVN/trunk
OS: WinXP/2 + Ubuntu + Mac 10.4.11
Compiler: VS2005 + GCC 4.2 + GCC 4.0.1
-----
home: http://www.salvania.be

upCASE
Site Admin
Site Admin
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Post by upCASE » Mon Jun 20, 2005 12:25 pm

Hi!
Did you try the wxWANTS_CHARS style?
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda

KaReL
Experienced Solver
Experienced Solver
Posts: 78
Joined: Mon Aug 30, 2004 8:52 am
Contact:

Post by KaReL » Mon Jun 20, 2005 8:29 pm

Yeps, no luck...

If i capture both EVT_KEY_DOWN as EVT_CHAR(_HOOK), it works like charm, but it's a little weird. As when the baseclass is a wxFrame, EVT_CHAR(_HOOK) receives all the events...
wxWidgets: SVN/trunk
OS: WinXP/2 + Ubuntu + Mac 10.4.11
Compiler: VS2005 + GCC 4.2 + GCC 4.0.1
-----
home: http://www.salvania.be

Post Reply