![]() |
Remove Control on Menu (2 levels deep) |
Post Reply ![]() |
Author | |
thodgson ![]() Groupie ![]() Joined: 11 August 2003 Status: Offline Points: 78 |
![]() ![]() ![]() ![]() ![]() Posted: 17 October 2005 at 1:11pm |
The following code will remove a command that is just below a top level menu, e.g. File -> Open, however if you try and remove one level below that, an ASSERT is thrown. How do I remove a menu item (control) that is 2 levels down, e.g. File -> Open -> Something?
Does not work for all controls... OnInitCommandsPopup (CXTPCommandBar* pCommandBar){ CXTPControl* pCommandSubItem = pCommandList->FindControl(xtpControlButton, ID_TOOLS_SUBITEM, TRUE, TRUE); if (pCommandSubItem) { pCommandList->Remove(pCommandSubItem); } } |
|
Tim H(http://www.ExclamationSoft.com)
Product: Xtreme Toolkit v13.1 Platform: Vista(x64)-SP1 Language: Visual C++ 6.0 Currently: Satisfied w/ Toolkit |
|
![]() |
|
thodgson ![]() Groupie ![]() Joined: 11 August 2003 Status: Offline Points: 78 |
![]() ![]() ![]() ![]() ![]() |
FYI: the parameter "visible" in the call to FindControl must be set to FALSE CXTPControl* pCommandSubItem = pCommandList->FindControl(xtpControlButton, ID_TOOLS_SUBITEM, 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 |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
instead pCommandList->Remove(pCommandSubItem); use pCommandSubItem->GetControls()->Remove(pCommandSubItem); |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
thodgson ![]() Groupie ![]() Joined: 11 August 2003 Status: Offline Points: 78 |
![]() ![]() ![]() ![]() ![]() |
Okay, that seems odd to use the object to remove itself, but...you guys wrote it and it works.
|
|
Tim H(http://www.ExclamationSoft.com)
Product: Xtreme Toolkit v13.1 Platform: Vista(x64)-SP1 Language: Visual C++ 6.0 Currently: Satisfied w/ Toolkit |
|
![]() |
|
mailhaim ![]() Newbie ![]() Joined: 28 September 2005 Status: Offline Points: 26 |
![]() ![]() ![]() ![]() ![]() |
I need to remove sub menu item too but the above suggestion does not work( pCommandSubItem->GetControls()->Remove(pCommandSubItem); ) An example: I have sub menu with 3 items: A, B & C. I try to remove C. When I open the menu I get A, B, B. Any ideas? |
|
![]() |
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 |