![]()  | 
 
Menu shortcuts no longer works | 
 
    Post Reply  
   | 
  
| Author | |
   
   BadJerry  
   
   Newbie  
   Joined: 22 July 2005 Location: United Kingdom Status: Offline Points: 8  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Topic: Menu shortcuts no longer worksPosted: 17 November 2008 at 7:25am  | 
 
| 
   
    
   Since installing the commandbars menu, Alt+F does not open the file menu in child dialog-boxes of a view... it works on the view itself...
 
   
  All the keyboard accelerators are lost as well... 
What can I do to make this work on all my dialog-boxes - ideally without too much work... 
Thanks in advance, 
Jerome 
    | 
 |
![]()  | 
 |
   
   Oleg  
   
   Senior Member  
   Joined: 21 May 2003 Location: United States Status: Offline Points: 11234  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 17 November 2008 at 9:01am | 
 
| 
   
    
   Hi,
 
   
  not clear how you use CommandBars. 
    | 
 |
| 
   
     
     Oleg, Support Team 
   
  CODEJOCK SOFTWARE SOLUTIONS  | 
 |
![]()  | 
 |
   
   BadJerry  
   
   Newbie  
   Joined: 22 July 2005 Location: United Kingdom Status: Offline Points: 8  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 17 November 2008 at 10:12am | 
 
| 
   
    
   I have a SDI and a MDI application... they both have (CFormView derived ) views which use CDialog derived child windows to display information.  It's within these windows that the shortcuts don't work anymore.
 
   
  
The mainframe window is derived from CXTPMDIFrameWnd. 
My dev environment is VC++ 6.0 SP6. 
Is there anything else you need? 
Jerome 
    | 
 |
![]()  | 
 |
   
   MGebler  
   
   Groupie  
   Joined: 18 May 2006 Location: Germany Status: Offline Points: 64  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 07 December 2008 at 4:14pm | 
 
| 
   
    
   Similiar constellation - same problem... 
   
  I took a look at the grep sample (Samples\Utilities\Grep) and I think that the problem can also been seen there: 1. Add a new accelerator ( ID_APP_EXIT = 'Alt+Q' ) 2. Compile and start the application 3. Click into the 'Find what' combo box so that it gets the input focus. 4a. Press 'Alt+F4' and the application quits 4b. Press 'Alt+Q' and nothing happens Help !!!  | 
 |
![]()  | 
 |
   
   MGebler  
   
   Groupie  
   Joined: 18 May 2006 Location: Germany Status: Offline Points: 64  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 08 December 2008 at 3:58am | 
 
| 
   
    
   I found a solution. 
   
  1st step - Add the following method to the owner of the command bar: BOOL BoostAccelerator( MSG* pMsg ) { if( GetCommandBars() && GetCommandBars()->GetShortcutManager() ) return GetCommandBars()->GetShortcutManager()->TranslateAccelerator( pMsg ); return FALSE; } 2nd step - Override the PreTranslateMessage method of the child dialog: virtual BOOL PreTranslateMessage(MSG* pMsg) { if( WM_KEYFIRST <= pMsg->message && pMsg->message <= WM_KEYLAST ) { CMainFrame* pMainFrame = ((CMainFrame*)AfxGetMainWnd()); if( pMainFrame && pMainFrame->BoostAccelerator( pMsg ) ) return TRUE; } return __super::PreTranslateMessage(pMsg); } The reason for this approach is that 'Accelerators are not an automatic thing for dialogs' (http://msdn.microsoft.com/de-de/magazine/cc301409(en-us).aspx). And now letīs have a look to the codejock grep sample - if I replace the CSearchOptionsView::PreTranslateMessage implementation with the BoostAccelerator version everything works in the right way. So dear codejock team - which is the right approach to handle accelerators in child dialogs?  | 
 |
![]()  | 
 |
    Post Reply  
   | 
  |
|       
  
  Tweet   	
    | 
 
| Forum Jump | Forum Permissions  ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum  |