![]()  | 
 
Dynamic menu | 
 
    Post Reply  
   | 
  
| Author | ||
   
   yoavo  
   
   Senior Member  
   Joined: 29 February 2004 Location: Israel Status: Offline Points: 140  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Topic: Dynamic menuPosted: 14 June 2004 at 1:36am  | 
 |
   
   
  | 
 ||
![]()  | 
 ||
   
   Oleg  
   
   Senior Member  
   Joined: 21 May 2003 Location: United States Status: Offline Points: 11234  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 18 June 2004 at 2:51am | 
 |
| 
   
    
   pMenuBar->GetControls()->Add(..)
    
   
   | 
 ||
| 
   
     
     Oleg, Support Team 
   
  CODEJOCK SOFTWARE SOLUTIONS  | 
 ||
![]()  | 
 ||
   
   yoavo  
   
   Senior Member  
   Joined: 29 February 2004 Location: Israel Status: Offline Points: 140  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 20 June 2004 at 12:54am | 
 |
   
   
  | 
 ||
![]()  | 
 ||
   
   Oleg  
   
   Senior Member  
   Joined: 21 May 2003 Location: United States Status: Offline Points: 11234  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 21 June 2004 at 1:39am | 
 |
| 
   
    
   You also can use pMenuBar->LoadMenu. 
    
   
   | 
 ||
| 
   
     
     Oleg, Support Team 
   
  CODEJOCK SOFTWARE SOLUTIONS  | 
 ||
![]()  | 
 ||
   
   yoavo  
   
   Senior Member  
   Joined: 29 February 2004 Location: Israel Status: Offline Points: 140  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 21 June 2004 at 11:32pm | 
 |
   
   
  | 
 ||
![]()  | 
 ||
   
   yoavo  
   
   Senior Member  
   Joined: 29 February 2004 Location: Israel Status: Offline Points: 140  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 22 June 2004 at 7:50am | 
 |
   
   
  | 
 ||
![]()  | 
 ||
   
   superppy  
   
   Newbie  
   Joined: 11 July 2004 Status: Offline Points: 1  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 11 July 2004 at 6:07am | 
 |
| 
   
    Simple example of dynamic menu : CXTPMenuBar* pMenuBar = GetCommandBars()->GetMenuBar(); pMenuBar->GetControls()->RemoveAll(); UINT nCmdID = 0x8000; CMenu mainMenu; mainMenu.CreateMenu(); CMenu fileMenu; fileMenu.CreateMenu(); fileMenu.AppendMenu(MF_STRING, nCmdID++, "Open"); fileMenu.AppendMenu(MF_SEPARATOR, 0, ""); fileMenu.AppendMenu(MF_STRING, nCmdID++, "New"); mainMenu.AppendMenu(MF_POPUP, (UINT)fileMenu.GetSafeHmenu(), "File"); CMenu editMenu; editMenu.CreateMenu(); editMenu.AppendMenu(MF_STRING, nCmdID++, "Cut"); editMenu.AppendMenu(MF_STRING, nCmdID++, "Paste"); mainMenu.AppendMenu(MF_POPUP,(UINT)editMenu.GetSafeHmenu(), "Edit"); pMenuBar->GetControls()->AddMenuItem(&mainMenu, 0); pMenuBar->GetControls()->AddMenuItem(&mainMenu, 1); 
 Edited by superppy  | 
 ||
![]()  | 
 ||
   
   djtompa  
   
   Newbie  
   Joined: 29 November 2004 Location: Germany Status: Offline Points: 4  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 29 November 2004 at 5:30am | 
 |
| 
   
    If I have created a menu as stated by superppy then how can I add icons. I tried the following: int nIDIcons[] = {nCmdID};XTPImageManager()->SetIcons(bitmapID, (UINT*) &nIDIcons, sizeof(nIDIcons)/sizeof(nIDIcons[0]), CSize(16, 16));But no icons are shown. Whats wrong? thank you  | 
 ||
![]()  | 
 ||
   
   SuperMario  
   
   Senior Member  
    
   Joined: 14 February 2004 Status: Offline Points: 18057  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 01 December 2004 at 9:12am | 
 |
| 
   
    
   nIDIcons is an array of ids for controls in your
menu.  It looks like you only have one id in your array.  You
need an id for each icon in the bitmap resource.  Check that the
id given to your menu controls match the ids in the nIDIcons array.
    
   
   | 
 ||
![]()  | 
 ||
   
   djtompa  
   
   Newbie  
   Joined: 29 November 2004 Location: Germany Status: Offline Points: 4  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 07 December 2004 at 11:12am | 
 |
| 
   
    Thank you for your help, but that doesnt seem to be the problem: if I take a nCmdID which belongs to the programs toolbar it wokrs perfectly. It just doesnt work with the cmdIds I generate during the creation of my contect menu. Do I somehow have to "tell" the XTPImageManger which cmdIds I create or something like that?  | 
 ||
![]()  | 
 ||
    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  |