![]() |
Tear off menu |
Post Reply ![]() |
Author | |
DavidH ![]() Groupie ![]() Joined: 24 March 2007 Status: Offline Points: 60 |
![]() ![]() ![]() ![]() ![]() Posted: 19 November 2009 at 11:22am |
What is the best way to get rid of the Toolbar Options menu in a tear off menu.
The problem is that the toolbar holding the menu is created only when the menu is teared off, and that there's no real hook to use to disable it. So I've tried to derive from CXTPPopupBar and call: m_pTearOffBar->ShowExpandButton(FALSE); m_pTearOffBar->SetContextMenuPresent(FALSE); m_pTearOffBar->EnableCustomization(FALSE); but this only results in CJ drawing the Expand button not in the title bar, but at the bottom of the window. I've also tried to to put an ON_UPDATE_COMMAND_UI on XTP_ID_TOOLBAR_EXPAND, and make the the control invisible, but the code is not reached for some reason. I guess the message is handled at a higher level. I'm sort of lost now. All help is very much appreciated! David. |
|
![]() |
|
DavidH ![]() Groupie ![]() Joined: 24 March 2007 Status: Offline Points: 60 |
![]() ![]() ![]() ![]() ![]() |
Well, it seems that I've solved it myself.
To get to the tear-off menu, add ON_XTP_CREATECOMMANDBAR() to the MESSAGE_MAP of CMainFrame. Then, add the following method: int CMainFrame::OnCreateCommandBar(LPCREATEBARSTRUCT lpCreateBar) { if (lpCreateBar->nID == ID_TEAR_OFF_MENU) { CXTPToolBar* pTearOffMenu((CXTPToolBar*)lpCreateBar->pCommandBar); if (pTearOffMenu) { pTearOffMenu->EnableCustomization(FALSE); pTearOffMenu->ShowExpandButton(FALSE); return TRUE; } } return FALSE; } Very simple, really, but it took me a day to figure it out :( David. |
|
![]() |
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 |