[wxGTK 2.6.3] Propagating key events?
Spencer Salazar
spencer.salazar at gmail.com
Fri Sep 15 18:30:53 PDT 2006
Hello,
I am using wxGTK 2.6.3 on Linux, with gcc-3.2.2. I have three frames
in my app, one parent wxFrame and two child wxFrames. The parent has
a menubar, and the children do not. However, I would like the
accelerators associated with the parent's menubar to be "understood"
in the child frames. For example, when someone hits Ctrl-N while a
child frame is the active window, the parent frame should create a
new document, even though the child frames themselves dont respond to
that key combination.
So far, Ive tried intercepting key events in the child frames and
forwarding them to the parent window, to no avail. Heres my code:
void myChildFrame::OnChar( wxKeyEvent & event )
{
GetParent()->ProcessEvent( event );
}
Im certain that this function is being called on key events; however,
valid key combinations defined in the parent's menu bar are not
responded to.
Is there a good way to do this? I dont want to actually have a menu
bar in the child frames for esthetic reasons, and I want to avoid
building separate wxAcceleratorTables to match the parent frame menu
bar, because that doesnt seem very maintainable. Thanks in advance.
spencer
More information about the wx-users
mailing list