![]()  | 
 
How to implement shortcut menus | 
 
    Post Reply  
   | 
  
| Author | |
   
   Number8  
   
   Groupie  
   Joined: 29 July 2008 Location: United States Status: Offline Points: 17  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Topic: How to implement shortcut menusPosted: 12 August 2008 at 1:57pm  | 
 
| 
   
    
   Hello, 
   
  Our application has several different kinds of child windows -- a graph, a spreadsheet, a text editor, etc. Can we use some kind of CommandBar to implement a shortcut menu for each window? How do we activate the menu (presumably from the WM_RBUTTONDOWN handler for the window)? Thanks for any advice or pointers to articles/samples/tutorials...  | 
 |
![]()  | 
 |
   
   Oleg  
   
   Senior Member  
   Joined: 21 May 2003 Location: United States Status: Offline Points: 11234  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 13 August 2008 at 1:20am | 
 
| 
   
    
   Hello,
 
   
  Most our samples show context menus. Please check them. 
    | 
 |
| 
   
     
     Oleg, Support Team 
   
  CODEJOCK SOFTWARE SOLUTIONS  | 
 |
![]()  | 
 |
   
   MadRiver  
   
   Groupie  
   Joined: 21 August 2008 Location: United States Status: Offline Points: 22  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 21 August 2008 at 1:45pm | 
 
| 
   
    
   
It looks like all the samples create the popup menu/commandbar at the time it is needed. 
   
  Two questions: -- What happens when this is done multiple times? Are duplicate items ignored? -- I would like to create my context menus at startup, then display them in the specific event handler. It's not clear how to find/retrieve the correct commandbar/popup object. For example, if I do something like this: ICommandBarPtr pPopup = 0; pPopup = g_spCommandBars->Add("MapperPopup", xtpBarPopup); pControls = pPopup->GetControls(); // add controls... If all that happens in the event handler for the right mouse click, this pPopup->ShowPopup(); works as expected. Thanks for any pointers...  | 
 |
![]()  | 
 |
   
   Oleg  
   
   Senior Member  
   Joined: 21 May 2003 Location: United States Status: Offline Points: 11234  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 22 August 2008 at 1:02am | 
 
| 
   
    
   Hello,
 
   
  Add("MapperPopup", xtpBarPopup) don't really add it to commandBars collection but just create it and return pointer. so it will be destroyed when your pPopup  will be destroyed. 
Better add it to ContextMenus collection. 
    | 
 |
| 
   
     
     Oleg, Support Team 
   
  CODEJOCK SOFTWARE SOLUTIONS  | 
 |
![]()  | 
 |
    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  |