Print Page | Close Window

Managing Menus in Designer Apps

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=13781
Printed Date: 19 July 2025 at 9:34pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Managing Menus in Designer Apps
Posted By: voripteth
Subject: Managing Menus in Designer Apps
Date Posted: 24 March 2009 at 2:46pm
I have a MDI app that is using Designer to load command bars and menus.  I'm trying to get the app to work like a traditional windows app with an abbreviated menu when no documents are open.  The DesignerSample has been my guide in creating the resources but unfortunately that example use the same menu when no documents are open.

ActionsSample looked promising since it can hide/disable menus and toolbars at the same time.  The code looks pretty straightforward but it isn't working as I expected.  I can't seem to find any documentation on Control Actions so I must be missing something.

I added code to CMainFrame::LoadFrame in the DesignerSample code:
    ...
    LoadCommandBars(lpProfile);

    // new code
    CXTPCommandBars* pCommandBars = GetCommandBars();
    CXTPControlActions* pActions = pCommandBars->GetActions();
    CXTPControlAction* pAction = pActions->FindAction(ID_FILE_SAVE);
    if (pAction)
        pAction->SetVisible (FALSE);        // Hide Edit menu

When this code executes pAction is always NULL.  ID_FILE_SAVE is there in the toolbar and menu.  Looking into pActions with the debugger I see that m_arrActions has no items in it.  What  needs to be done to get the Actions array populated?

If there is a better way to getting the two sets of command bars for document/no document please let me know.
Thanks!



-------------
Product: ToolkitPro (MFC) v13.0.0
Platform: Windows XP(32bit)-SP 3
Language: VC++ 2008



Replies:
Posted By: Oleg
Date Posted: 25 March 2009 at 2:20am
Hi,
 
Are you sure you enabled Actions in Designer ?


-------------
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