0
我有一個用於contextmenu的彈出菜單。並且我爲CMainframe中的每個菜單編寫了函數。 我有OnContextMenu()在每個視圖類,並在一個對話框中class.Its對話框class.But工作正常,沒有查看class.Codings低於: CMainFrame的功能可按:OnContextMenu()不工作在視圖類
void CMainFrame::OnUpdateFptrend(CCmdUI* pCmdUI)
{
((CMainFrame *)AfxGetMainWnd())->SendMessage(WM_COMMAND,ID_TRENDVIEW,NULL);
}
void CMainFrame::OnUpdateFptuning(CCmdUI* pCmdUI)
{
((CMainFrame *)AfxGetMainWnd())->SendMessageWM_COMMAND,ID_TUNINGVIEW,NULL);
}
Dialog類文本菜單:
void CFacePlate::OnContextMenu(CWnd* pWnd, CPoint point)
{
CMenu mnuPopup;
mnuPopup.LoadMenu(IDR_FPMENU);
CRect rBarRect;
rBarRect.left = rBarRect.top = 0;
rBarRect.right = 1000;rBarRect.bottom = 300;
CMenu *mnuPopupMenu = mnuPopup.GetSubMenu(0);
ASSERT(mnuPopupMenu);
if(rBarRect.PtInRect(point))
mnuPopupMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this);
}
視圖類:
void CGroupView::OnContextMenu(CWnd* pWnd, CPoint point)
{
CMenu mnuPopup;
mnuPopup.LoadMenu(IDR_FPMENU);
CRect rBarRect;
rBarRect.left = rBarRect.top = 0;
rBarRect.right = 1150;rBarRect.bottom = 390;
CMenu *mnuPopupMenu = mnuPopup.GetSubMenu(0);
ASSERT(mnuPopupMenu);
if(rBarRect.PtInRect(point))
mnuPopupMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this);
}
當我按下面板從(Dialogclass)彈出式菜單,它關係到大型機function.At的同時當我按任何視圖類的菜單,它不會去大型機功能。爲什麼它是這樣的?