Popup menu on cgridctrl
-
I need to have a popup menu on the grid, but it doesn't look like it should. The main menu's text isn't shown, only a small blank menu, on the other hand the submenus show up and work properly if I position the cursor above the blank menu. Any idea? WinXP, VC 6.00 SP6 void CGridCtrlDemoDlg::OnGridRClick(NMHDR *pNotifyStruct, LRESULT* /*pResult*/) { NM_GRIDVIEW* pItem = (NM_GRIDVIEW*) pNotifyStruct; Trace(_T("Right button click on row %d, col %d\n"), pItem->iRow, pItem->iColumn); // To test popup menu CPoint mypoint; GetCursorPos(&mypoint); pM = new CMenu(); pM->LoadMenu(IDR_POPUP); pM->TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON, mypoint.x,mypoint.y, AfxGetMainWnd()); }
-
I need to have a popup menu on the grid, but it doesn't look like it should. The main menu's text isn't shown, only a small blank menu, on the other hand the submenus show up and work properly if I position the cursor above the blank menu. Any idea? WinXP, VC 6.00 SP6 void CGridCtrlDemoDlg::OnGridRClick(NMHDR *pNotifyStruct, LRESULT* /*pResult*/) { NM_GRIDVIEW* pItem = (NM_GRIDVIEW*) pNotifyStruct; Trace(_T("Right button click on row %d, col %d\n"), pItem->iRow, pItem->iColumn); // To test popup menu CPoint mypoint; GetCursorPos(&mypoint); pM = new CMenu(); pM->LoadMenu(IDR_POPUP); pM->TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON, mypoint.x,mypoint.y, AfxGetMainWnd()); }
you have to get submenu for show like this: pM = new CMenu(); pM->LoadMenu(IDR_POPUP); CMenu* pSubMenu = pM->GetSubMenu(0); pSubMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON, mypoint.x,mypoint.y, AfxGetMainWnd());
-
you have to get submenu for show like this: pM = new CMenu(); pM->LoadMenu(IDR_POPUP); CMenu* pSubMenu = pM->GetSubMenu(0); pSubMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON, mypoint.x,mypoint.y, AfxGetMainWnd());