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. Context Menu to a CTreeCtrl

Context Menu to a CTreeCtrl

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestionlearning
4 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.
  • L Offline
    L Offline
    Like2Byte
    wrote on last edited by
    #1

    I'm trying to add a context menu to a CTreeCtrl. Any clues on how to do this? I've created an IDR_MENU resource item but can't seem to combine it with a right-click. The CTreeCtrl doesn't seem to be aware (that I'm aware of) of WM_CONTEXTMENU. Will I have to create an OnRClick Event handler and build the menu dynamically?

    C 1 Reply Last reply
    0
    • L Like2Byte

      I'm trying to add a context menu to a CTreeCtrl. Any clues on how to do this? I've created an IDR_MENU resource item but can't seem to combine it with a right-click. The CTreeCtrl doesn't seem to be aware (that I'm aware of) of WM_CONTEXTMENU. Will I have to create an OnRClick Event handler and build the menu dynamically?

      C Offline
      C Offline
      Code o mat
      wrote on last edited by
      #2

      Handle the NM_RCLICK notification sent by the tree, you can even handle it in the class of the tree itself with ON_REFLECT_NOTIFY if you like, load your menu using CMenu::LoadMenu, display it with TrackPopupMenu or TrackPopupMenuEx.

      > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <

      L 1 Reply Last reply
      0
      • C Code o mat

        Handle the NM_RCLICK notification sent by the tree, you can even handle it in the class of the tree itself with ON_REFLECT_NOTIFY if you like, load your menu using CMenu::LoadMenu, display it with TrackPopupMenu or TrackPopupMenuEx.

        > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <

        L Offline
        L Offline
        Like2Byte
        wrote on last edited by
        #3

        Thank you, That's what I was beginning to think about the right click. The TrackPopupMenu/Ex is the key - I was using SetMenu! LOL

        R 1 Reply Last reply
        0
        • L Like2Byte

          Thank you, That's what I was beginning to think about the right click. The TrackPopupMenu/Ex is the key - I was using SetMenu! LOL

          R Offline
          R Offline
          rvangaal
          wrote on last edited by
          #4

          See also http://support.microsoft.com/kb/222905[^]

          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