Getting CMenu from CXTPControlPopup I get error |
Post Reply |
Author | |||||
sdancer75
Groupie Joined: 08 July 2008 Location: Greece Status: Offline Points: 70 |
Post Options
Thanks(0)
Posted: 23 September 2014 at 8:31am |
||||
Hi,
I want to change (insert or delete item) the popup menu of a CXTPControlPopup dynamically. I use the following code below, but everytime I am trying to get access to the popup menu I assertion error. Any Ideas ? m_pPopupHistory = (CXTPControlPopup*)pGroup0->Add(xtpControlButtonPopup, ID_POPUP_HISTORY); pPopupBar = CXTPPopupBar::CreatePopupBar(GetCommandBars()); m_pPopupHistory->SetCommandBar(pPopupBar); m_PopupHistoryMenu.LoadMenu(IDR_MENU_HISTORY); pPopupBar->LoadMenu(m_PopupHistoryMenu.GetSubMenu(0)); pPopupBar->InternalRelease(); ........................................................... //somewhere in my code CXTPPopupBar *pChildBar = (CXTPPopupBar*)m_pPopupHistory->GetCommandBar(); CMenu *mm = pChildBar->GetMenu(); // <-- At this point I get assertion error mm->AppendMenu(MF_STRING, 1, "Text 1"); pChildBar->InternalRelease(); |
|||||
Just me!
|
|||||
olebed
Admin Group Joined: 01 July 2014 Location: Ukraine Status: Offline Points: 841 |
Post Options
Thanks(0)
|
||||
Hi,
Can you please provide a small sample application so that we could debug this issue? Make sure that pChildBar is not NULL and also really belongs to CXTPPopupBar class. Thank you. Regards, Oleksandr Lebed |
|||||
sdancer75
Groupie Joined: 08 July 2008 Location: Greece Status: Offline Points: 70 |
Post Options
Thanks(0)
|
||||
Thanks for the reply.
I can verify that pChildBar is not null. I attach the original sample "Ribbon Controls" where I added my offended custom code at line number 524 inside the MainFrm.cpp. Thanks |
|||||
Just me!
|
|||||
olebed
Admin Group Joined: 01 July 2014 Location: Ukraine Status: Offline Points: 841 |
Post Options
Thanks(0)
|
||||
but pChildBar->m_hWnd is NULL that is why assertion fired
pPopupBar->LoadMenu(mmenu.GetSubMenu(0)) converts menu items to command bar controls. That is why you can't get CMenu which was loaded. But you can use
Fro example:
|
|||||
sdancer75
Groupie Joined: 08 July 2008 Location: Greece Status: Offline Points: 70 |
Post Options
Thanks(0)
|
||||
Hi, Thank you for your quick response. I was suspicious with the LoadMenu() thing. In fact, I thought that the pPopupBar->LoadMenu(xxx) may have suppressed the CMenu structure in some way since the way you showed me to solve the problem, was already tested and verified that it works just fine..... I should check the source code before I ask... but you help was precious and saved my time ! Best Regards,
|
|||||
Just me!
|
|||||
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 |