Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

JonW

MFC: MDI child windows and accelerator keys

This topic is 5491 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I have a MDI app that has three different menus -- one for the main frame, and one for each of the two different child frame types. The code in InitInstance looks similar to this: pTemplate = new CMultiDocTemplate( IDR_CHILD1, RUNTIME_CLASS(CChild1Doc), RUNTIME_CLASS(CChildFrame), // custom MDI child frame RUNTIME_CLASS(CChild1View)); AddDocTemplate(pTemplate); pTemplate = new CMultiDocTemplate( IDR_CHILD2, RUNTIME_CLASS(CChild2Doc), RUNTIME_CLASS(CChildFrame), // custom MDI child frame RUNTIME_CLASS(CChild2View)); AddDocTemplate(pTemplate); // create main MDI Frame window CMainFrame* pMainFrame = new CMainFrame; if (!pMainFrame->LoadFrame(IDR_MAINFRAME)) return FALSE; m_pMainWnd = pMainFrame; The menus IDR_CHILD1, IDR_CHILD2, and IDR_MAINFRAME show up when they are supposed to. But now I want to have seperate accelerator keys for each of the three frames. So I created three accelerator table resources called IDR_CHILD1, IDR_CHILD2, and IDR_MAINFRAME. When the program first starts out and there are no child windows up, the accelerator keys for IDR_MAINFRAME work fine. For example, I can press CTRL+O to open a file. But when one of the child windows are up, the accelerator keys for that frame don''t work anymore. I put the CTRL+O accelerator key in the IDR_CHILD1 table for example, but when the frame for child 1 is showing, nothing happens when I press CTRL+O. Any idea what could be wrong? Does MFC allow accelerator tables for MDI child frames? Thanks a bunch.

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!