MFC 单文档视图 取消下拉菜单项的折叠问题

CMFCMenuBar remove "Expand Submenu" Double Arrow (display recently and all available menu commands always)
  • Question

  • Hello,
    I am trying to disable the feature "Expand Submenu" Double Arrow (VS2010 MFC MDI Application) to display always the recently and all available menu commands, so the user does not need to click the Double Arrow first to open the menu items. I added the following calls in the CMainFrame::OnCreate function:
            m_wndMenuBar.SetShowAllCommands( TRUE );
            m_wndMenuBar.SetRecentlyUsedMenus( TRUE );
    
    
    But this doesn't help, because in the
    void CMFCMenuBar::OnChangeHot(int iHot)
    
    
    function the flag m_bShowAllCommands is reset to FALSE.
    I can derive my own menubar class from CMFCMenuBar and override the OnChangeHot function and set the flag to TRUE after calling the OnChange base class function (than it works as wanted), but is this the intended way?
    Thanks,

    Andreas
    Thursday, September 15, 2011 9:11 AM

                Answers           

  • You don't want the "intellegent menus" feature, some menu items are hidden, and you have to click to show the whole menu?

    To disable this feature, go to CMainFrame::OnCreate. You will see some code like this:

    	// enable menu personalization (most-recently used commands)
    	// TODO: define your own basic commands, ensuring that each pulldown menu has at least one basic command.
    	CList<UINT, UINT> lstBasicCommands;
    
    	lstBasicCommands.AddTail(ID_FILE_NEW);
    	lstBasicCommands.AddTail(ID_FILE_OPEN);
    ...
    	lstBasicCommands.AddTail(ID_SORTING_GROUPBYTYPE);
    
    	CMFCToolBar::SetBasicCommands(lstBasicCommands);
    
    
    Remove it.

    Friday, September 16, 2011 11:56 AM

                All replies           

  • You don't want the "intellegent menus" feature, some menu items are hidden, and you have to click to show the whole menu?

    To disable this feature, go to CMainFrame::OnCreate. You will see some code like this:

    	// enable menu personalization (most-recently used commands)
    	// TODO: define your own basic commands, ensuring that each pulldown menu has at least one basic command.
    	CList<UINT, UINT> lstBasicCommands;
    
    	lstBasicCommands.AddTail(ID_FILE_NEW);
    	lstBasicCommands.AddTail(ID_FILE_OPEN);
    ...
    	lstBasicCommands.AddTail(ID_SORTING_GROUPBYTYPE);
    
    	CMFCToolBar::SetBasicCommands(lstBasicCommands);
    
    
    Remove it.

    Friday, September 16, 2011 11:56 AM
  • Yes, thanks, that's what I was looking for.


    Andreas
    Monday, September 19, 2011 7:35 AM
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值