Popup menues and message mapping
Joern Dahl-Stamnes -- Jorn.Dahl-Stamnes@fysel.ntnu.no Thursday, November 28, 1996 Environment: VC++ 1.52, NT 3.51 I have a MDI application with a view based on CView. Thew view have a OnRButtonDown where I open a popup menu. void CVeloView::OnRButtonDblClk(UINT nFlags, CPoint point) { CMenu Popup; int i, j; Popup.LoadMenu (IDR_MENU1); Popup.GetSubMenu(0)->TrackPopupMenu ((TPM_LEFTALIGN | TPM_RIGHTBUTTON), point.x,point.y,this); // CView::OnLButtonDblClk (nFlags,point); } To add commands in the menu mapped to the viewes message map is no problem, but how can I add a command that is mapped to the e.g. document message map (CMyDoc class) or the CMainFrame?
Bibhas Bhattacharya -- bibhas@isgtec.com Saturday, November 30, 1996 > Popup.LoadMenu (IDR_MENU1); > Popup.GetSubMenu(0)->TrackPopupMenu ((TPM_LEFTALIGN | TPM_RIGHTBUTTON), > point.x,point.y,this); > Popup.GetSubMenu(0)->TrackPopupMenu ((TPM_LEFTALIGN | TPM_RIGHTBUTTON), point.x,point.y, AfxGetMainWnd()); Use the main frame window to route the command. You can create a dummy menu from the resource to help add command handlers from the document. Bibhas. bibhas@isgtec.com
| Вернуться в корень Архива |