Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Managing Menus in Designer Apps
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Managing Menus in Designer Apps

 Post Reply Post Reply
Author
Message
voripteth View Drop Down
Newbie
Newbie
Avatar

Joined: 24 March 2009
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote voripteth Quote  Post ReplyReply Direct Link To This Post Topic: Managing Menus in Designer Apps
    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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 25 March 2009 at 2:20am
Hi,
 
Are you sure you enabled Actions in Designer ?
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.063 seconds.