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. Pop up menu on Right Click in List view

Pop up menu on Right Click in List view

Scheduled Pinned Locked Moved C / C++ / MFC
5 Posts 3 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.
  • Y Offline
    Y Offline
    Y K Kishore Kumar
    wrote on last edited by
    #1

    Hi all, Can any one please tell me the code for loading a popup menu on right click on a particular item in a list view. Thanks. Kishore.

    H 1 Reply Last reply
    0
    • Y Y K Kishore Kumar

      Hi all, Can any one please tell me the code for loading a popup menu on right click on a particular item in a list view. Thanks. Kishore.

      H Offline
      H Offline
      Hamid Taebi
      wrote on last edited by
      #2

      You can use of NM_RCLICK event and then load your menu.


      WhiteSky


      Y 1 Reply Last reply
      0
      • H Hamid Taebi

        You can use of NM_RCLICK event and then load your menu.


        WhiteSky


        Y Offline
        Y Offline
        Y K Kishore Kumar
        wrote on last edited by
        #3

        I have already tried using the NM_RCLICK event. But the menu is not being loaded for some reason. Please give me a sample code for loadmenu in List view. Kishore

        H D 2 Replies Last reply
        0
        • Y Y K Kishore Kumar

          I have already tried using the NM_RCLICK event. But the menu is not being loaded for some reason. Please give me a sample code for loadmenu in List view. Kishore

          H Offline
          H Offline
          Hamid Taebi
          wrote on last edited by
          #4

          Can you show your code how did you declare it,please?


          WhiteSky


          1 Reply Last reply
          0
          • Y Y K Kishore Kumar

            I have already tried using the NM_RCLICK event. But the menu is not being loaded for some reason. Please give me a sample code for loadmenu in List view. Kishore

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            Y K Kishore Kumar wrote:

            I have already tried using the NM_RCLICK event.

            Does this imply that you are handling the NM_RCLICK notification? If so, then you should have something like:

            BEGIN_MESSAGE_MAP(CMyView, CListView)
            //{{AFX_MSG_MAP(CMyView)
            ON_NOTIFY_REFLECT(NM_RCLICK, OnRclick)
            //}}AFX_MSG_MAP
            END_MESSAGE_MAP()
            ...
            void CMyView::OnRclick(LPNMHDR, LRESULT* pResult)
            {
            CListCtrl &ctrlList = GetListCtrl();
            CPoint pt;
            CMenu menu,
            *pSubMenu;

            if (ctrlList.GetNextItem(-1, LVIS\_SELECTED) != -1)
            {
                menu.LoadMenu(IDR\_ITEM\_MENU);
                pSubMenu = menu.GetSubMenu(0);
            
                // where was the mouse clicked?
                pt = GetMessagePos();
            
                pSubMenu->TrackPopupMenu(TPM\_LEFTALIGN, pt.x, pt.y, this);
            }
            
            \*pResult = 0;
            

            }


            "A good athlete is the result of a good and worthy opponent." - David Crow

            "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

            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