![]() |
Remove menu item at runtime |
Post Reply
|
| Author | |
XIII
Newbie
Joined: 15 June 2005 Status: Offline Points: 1 |
Post Options
Thanks(0)
Quote Reply
Topic: Remove menu item at runtimePosted: 24 June 2005 at 3:26am |
|
Hello,
I'm using XToolKit Pro and I don't know how to remove menu item at runtime ? Before Xtoolkit i did it like this : ((CMainFrame *)m_pMainWnd)->GetMenu()->RemoveMenu(ID_FILE_PRINT, MF_BYCOMMAND); pCmdUI->Enable(FALSE); Can anybody help me ? Thanks |
|
![]() |
|
larryp
Groupie
Joined: 15 January 2005 Location: United States Status: Offline Points: 61 |
Post Options
Thanks(0)
Quote Reply
Posted: 24 June 2005 at 4:18pm |
|
Try the following:
CXTPControls* pControls = NULL; CXTPCommandBars* pCommandBars = GetCommandBars(); if ( pCommandBars != NULL ) { CXTPMenuBar* pMenuBar = pCommandBars->GetMenuBar(); if ( pMenuBar != NULL ) { pControls = pMenuBar->GetControls(); } } if ( pControls != NULL ) { // Hide the button from the menu CXTPControl* pControl = pControls->FindControl(xtpControlButton, ID_FILE_LOGOFF, FALSE, TRUE); if ( pControl != NULL ) { pControl->SetVisible (FALSE); } } Larry |
|
![]() |
|
thodgson
Groupie
Joined: 11 August 2003 Status: Offline Points: 78 |
Post Options
Thanks(0)
Quote Reply
Posted: 24 June 2005 at 8:23pm |
|
To remove items, this is what we use: CXTPControl* pCommandMenuItem = pCommandList->FindControl(xtpControlButton, ID_MENU_ITEM, TRUE, FALSE); |
|
|
Tim H(http://www.ExclamationSoft.com)
Product: Xtreme Toolkit v13.1 Platform: Vista(x64)-SP1 Language: Visual C++ 6.0 Currently: Satisfied w/ Toolkit |
|
![]() |
|
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 |