回答(1)
wustguangh 19级 2014-12-27 11:48:05
CAA的菜单栏工具条是(CATDlgBarMenu),其中包含一个或者多个子菜单CATDlgSubMenu,CATDlgSubMenu可以包含子菜单或者具体的菜单项,下面是初始化CAA对话框菜单栏的实例代码:
//初始化菜单栏 void ActivityPropertiesDlg::InitMenuBar() { // Menu Bar CATDlgBarMenu * pMenuBar = NULL ; pMenuBar = new CATDlgBarMenu(this, "MenuBar"); //1. 显示菜单栏 CATDlgSubMenu * pFileMenu = NULL ; pFileMenu = new CATDlgSubMenu(pMenuBar, "显示"); _pCheckItemActivityList = new CATDlgCheckItem(pFileMenu, "Activity列表"); AddAnalyseNotificationCB(_pCheckItemActivityList, _pCheckItemActivityList->GetChkIModifyNotification(), (CATCommandMethod)&ActivityPropertiesDlg::SwitchActivityList, NULL); //2. 操作菜单栏 CATDlgSubMenu * pOperateMenu = NULL ; pOperateMenu = new CATDlgSubMenu(pMenuBar, "操作"); CATDlgPushItem* pInsertIntoDB = new CATDlgPushItem(pOperateMenu, "插入记录[数据库]"); AddAnalyseNotificationCB(pInsertIntoDB, pInsertIntoDB->GetMenuIActivateNotification(), (CATCommandMethod)&ActivityPropertiesDlg::InsertToDB, NULL); CATDlgPushItem* pPrintRecord = new CATDlgPushItem(pOperateMenu, "打印记录[数据库]"); AddAnalyseNotificationCB(pPrintRecord, pPrintRecord->GetMenuIActivateNotification(), (CATCommandMethod)&ActivityPropertiesDlg::TestQuery, NULL); CATDlgPushItem* pSendTreeCtrlMsg = new CATDlgPushItem(pOperateMenu, "选中节点消息[CTreeCtrl]"); AddAnalyseNotificationCB(pSendTreeCtrlMsg, pSendTreeCtrlMsg->GetMenuIActivateNotification(), (CATCommandMethod)&ActivityPropertiesDlg::SendTreeCtrlSelectMsg, NULL); }
给菜单添加回调函数与给按钮等其他控件添加回调函数使用的方法类似,都是使用AddAnalyseNotificationCB。