Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Popup menu on cgridctrl

Popup menu on cgridctrl

Scheduled Pinned Locked Moved C / C++ / MFC
cssdebuggingquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tuxyboy
    wrote on last edited by
    #1

    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()); }

    O 1 Reply Last reply
    0
    • T tuxyboy

      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()); }

      O Offline
      O Offline
      only coder
      wrote on last edited by
      #2

      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());

      T 1 Reply Last reply
      0
      • O only coder

        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());

        T Offline
        T Offline
        tuxyboy
        wrote on last edited by
        #3

        Thanks, but the submenus work just fine, the main menu doesn't show up. I have a popup menu item as the main menu, which shows up as a blank item, but if I position the mouse over it the submenu show up as it should. Better idea?

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups