Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Append several items dynamically
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Append several items dynamically

 Post Reply Post Reply
Author
Message
kidani View Drop Down
Newbie
Newbie


Joined: 10 August 2004
Location: Japan
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote kidani Quote  Post ReplyReply Direct Link To This Post Topic: Append several items dynamically
    Posted: 10 August 2004 at 7:50am

Hi,

I want to append several items dynamically to the existing menu.
I know I can do that with MFC like this.

--------------------------------------------------
 UINT nCmdID = 0x8000;

 CMenu*  pTopMenu;
 CMenu*  pSubMenu;

 pTopMenu = GetMenu();
 pSubMenu = pTopMenu->GetSubMenu(0);

 CMenu PopupMenu;
 PopupMenu.CreatePopupMenu ();
 PopupMenu.AppendMenu ( MF_STRING, nCmdID++, "submenu 1" );
 PopupMenu.AppendMenu ( MF_SEPARATOR );
 PopupMenu.AppendMenu ( MF_STRING, nCmdID++, "sabumenu 2" );
 pSubMenu->ModifyMenu( 7, MF_BYPOSITION | MF_POPUP, ( UINT ) PopupMenu.Detach (), "New Menu");

--------------------------------------------------
How can I do that with Toolkit Pro?
I know the GetMenu() always return NULL with the Toolkit Pro.

Thanks,
S. kidani

 

Back to Top
kidani View Drop Down
Newbie
Newbie


Joined: 10 August 2004
Location: Japan
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote kidani Quote  Post ReplyReply Direct Link To This Post Posted: 16 August 2004 at 8:40pm

Please disregard, I finally figured out what I was doing wrong.
I resolved this by CXTPMenuBar::LoadMenu(CMenu*);

  UINT nCmdID = 0x8000;

 // Get CXTPMenuBar Pointer
 CXTPMenuBar* pMenuBar = GetCommandBars()->GetMenuBar();

 CMenu  TopMenu;
 CMenu*  pSubMenu;
 CMenu  PopupMenu;

 VERIFY(TopMenu.LoadMenu(IDR_MAINFRAME));
 // get the target menu pointer
 pSubMenu = TopMenu.GetSubMenu(0);
 PopupMenu.CreatePopupMenu ();
 PopupMenu.AppendMenu ( MF_STRING, nCmdID++, "submenu 1" );
 PopupMenu.AppendMenu ( MF_STRING, nCmdID++, "submenu 2" );
 pSubMenu->ModifyMenu( 2, MF_BYPOSITION | MF_POPUP | MF_ENABLED, ( UINT ) PopupMenu.Detach (), "New Menu");
 pMenuBar->LoadMenu(&TopMenu);

Best regards,
S.Kidani

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.