Accelerators/focus in CPropertySheet based MDI
Pete Chestna -- pchestna@highground.com Monday, October 21, 1996 Environment: VC++ 4.1, NT 4.0 I am developing an MDI application and have chosen to embed modeless CPropertySheets inside CScrollView based MDI windows. I am working on accelerators and focus issues and have found some interesting behavior. When the property page has focus: Top level menu accelerators (alt-f for &File) work Alt-F4 works to close the application Ctrl-F4 doesn't work to close the current MDI Alt-VK_SPACE and Alt- work for window menus work None of my defined menu accelerators work Also, when I first create the MDI, I haven't been able to figure out how to give the property page the initial focus. In fact, in this state, all of my accelerators work. As soon as I click on a control, I get the above behavior. I have been diving in MFC to try to figure out how message routing has changed, but haven't come across anything yet. Any help on this would be greatly appreciated. Pete --- "To you -- is it movement or is it action? Peter J. Chestna It is contact or just reaction? HighGround Systems And you -- revolution or just resistance? PChestna@highground.com Is it living, or just existence?" - RUSH (508) 263-5588 x.125
Doug Persons -- persons@esca.com Wednesday, October 23, 1996 [Mini-digest: 2 responses] Pete Chestna wrote: > > Environment: VC++ 4.1, NT 4.0 > > I am developing an MDI application and have chosen to embed modeless > CPropertySheets inside CScrollView based MDI windows. I am working on > accelerators and focus issues and have found some interesting behavior. > The problem is that 'IsDialogMessage' message is eating all the frame window accelerators. MFC handles this problem for you in CFormView::PreTranslateMessage - it lets the frame windows translate the accelerators before the call to 'IsDialogMessage' is made. You will have to do the same thing since you are not using CFormView. I'm not sure I have found the best place to override PreTranslateMessage, but I overrode it in my class derived from CPropertySheet. To set focus to the first property page, add a message handler to your view class for WM_SETFOCUS. When your view gets the WM_SETFOCUS, call the SetFocus method on your PropertySheet, which will put the focus on the first page on the sheet. -- Doug Persons 206-822-6800 persons@esca.com Cegelec ESCA Corporation Bellevue, WA http://www.esca.com -----From: ganeshs@nationwide.com Override your CPropertySheet-derived class's PreTranslateMessage() and call TranslateAccelerator() from over there, chain to the base-class version if no translation occurs... > Also, when I first create the MDI, I haven't been able to figure out how to > give the property page the initial focus. In fact, in this state, all of my > accelerators work. As soon as I click on a control, I get the above >behavior. To give the focus to a particular control on a property page when the page is activated, override OnSetActive() in your CPropertyPage-derived class, and post a user message to the page, which in turn sets the focus to the desired control... / ___| / ___| __ _ _ __ ___ ___| | I do not speak for \___ \ | | _ / _` | '_ \ / _ \/ __| '_ \ Tata Unisys or ___) | | |_| | (_| | | | | __/\__ \ | | |Nationwide Ins. |____(_) \____|\__,_|_| |_|\___||___/_| |_|------------------
| Вернуться в корень Архива |