![]() |
How to get Submenu? |
Post Reply ![]() |
Author | |||
kent_t ![]() Groupie ![]() Joined: 15 July 2008 Status: Offline Points: 13 |
![]() ![]() ![]() ![]() ![]() Posted: 06 November 2008 at 5:55pm |
||
CJ Version: 12.0.0, MSVC++ 2005, MFC
I want to * programmatically * change a Submenu from within a standard MFC MAIN menu with a check mark. There should be a CheckMenuItem(...) call somewhere, right? I've looked through all the CommandBar samples. No joy. (Maybe I missed something.) I have this in CMainFrame::OnCreate(...); ...
I can call mpMainMenuBar from other class's and it provides me the same behavior as below. In another class I call:
Sadness. This is how you would do it in normal MFC. From MS example.
Any help to achieve this would be appreciated. Thank you. |
|||
![]() |
|||
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
||
Hi,
try
CXTPMenuBar* pMB = pCB->GetMenuBar();
pMB->GetControl(0)->GetCommandBar(); |
|||
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|||
![]() |
|||
kent_t ![]() Groupie ![]() Joined: 15 July 2008 Status: Offline Points: 13 |
![]() ![]() ![]() ![]() ![]() |
||
I now have the code below. The cnt return value reflects the correct number of items in the associated menus. I believe I have the correct menu "controls." They are MenuItems, aren't they. The id's obtained from the CXTPControl.GetID() calls are correct. The controls have the resource.h ID's that they should.
Note: mpMainMenuBar is set in the OnCreate function above. The SetCheck call does NOTHING. Zero. I am losing faith rapidly.
Please Advise. |
|||
![]() |
|||
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
||
Hello,
Guess you check wrong controls.
I very recommend use standard MFC Update handlers - as advantage you don't need afraid that your user remove/move/delete or copy this control in Customization dialog.
Add
ON_UPDATE_COMMAND_UI(ID_P0_ID, OnUpdateP0)
and
void CMainFrame::OnUpdateP0(CCmdUI* pCmdUI)
{ pCmdUI->SetCheck(m_bP0IsChecked); } |
|||
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|||
![]() |
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 |