Print Page | Close Window

Can't Enabled Popup Menu. It Is Always Disabled.

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=6656
Printed Date: 12 November 2025 at 11:34am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Can't Enabled Popup Menu. It Is Always Disabled.
Posted By: cjsnewbie
Subject: Can't Enabled Popup Menu. It Is Always Disabled.
Date Posted: 15 March 2007 at 3:25pm
Hi all,
I am using part of ribbon bar in my project. I'm trying to add one button on the right hand side - similar to  help button in  ribbon bar  SDI sample -  and setting it to one menu.

My problem is that sub menu (in following example it is "TestC") always stays disabled. I tried to enable it manually by calling EnableMenuItem, but it's not working.

Can somebody help me to find out what's going on? Here is sample code of what I'm doing...

This is how menu is defined in resource file:

IDR_TESTM MENU
BEGIN
    POPUP "Test"
    BEGIN
        MENUITEM "TestA",                 ID_TEST_A
        MENUITEM "TestB",                 ID_TEST_B
        POPUP "TestC"
        BEGIN
            MENUITEM "SubTestC_1",        ID_SUBTESTC_1
            MENUITEM "SubTestC_2",        ID_SUBTESTC_2
            MENUITEM "SubTestC_3",        ID_SUBTESTC_3
            MENUITEM "SubTestC_4",        ID_SUBTESTC_4
        END
        MENUITEM "About Test",            ID_ABOUT_TEST
    END
END

This is how I'm creating and setting it to menu described above:

CXTPCommandBars* pCommandBars = GetCommandBars();

CXTPRibbonBar* pRibbonBar = (CXTPRibbonBar*)pCommandBars->Add(_T("MyTestRibbon"), xtpBarTop, RUNTIME_CLASS(CXTPRibbonBar));

CXTPControlPopup* pTest = (CXTPControlPopup*)pRibbonBar->GetControls()->Add(xtpControlPopup, -1);
pTest->SetFlags(xtpFlagRightAlign);
CMenu TestM;
TestM.LoadMenu(IDR_TESTM);
pTest->SetCommandBar(TestM.GetSubMenu(0));
pTest->SetCaption(_T("Click Here"));


So, again, problem is sub menu items under "TestC" are always disabled.

Sample SDI Ribbon Bar has similar submenu, and that works. So do I need to set any flags or values or something?

Thanks in advance.



Replies:
Posted By: Oleg
Date Posted: 16 March 2007 at 12:17am
Hi,
Do you have handlers for these commands?


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net