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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. treeview ctrl rmb menu question

treeview ctrl rmb menu question

Scheduled Pinned Locked Moved C / C++ / MFC
questionvisual-studio
2 Posts 2 Posters 2 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.
  • B Offline
    B Offline
    bobfresh
    wrote on last edited by
    #1

    I have recently written a 'project browser' ctrl for my hobby ide BUT when i right click on an item to 'select item and show menu' even though the carat is on the new item the control reports the active TREEVIEWITEM is the previously selected item and the menu acts on the prev selected item. With listboxes its easy you just subclass the ctrl and simulate "press lmb down and lmb up" when rmb is pressed but this method doesnt work at all with treeviews. How do i select a item with the rmb? Ps. you can be technical with your responce, im v.familiar w/ winapi. :) thx bob Sorry guys lol. Just solved it. You use the TVM_HITTEST to get the current item under the mouse cursor then call TVM_SELECTITEM w/ that item. Then call trackpopupmenu as normal. 4 hours wasted last night on that one... still happy ending. ;)

    L 1 Reply Last reply
    0
    • B bobfresh

      I have recently written a 'project browser' ctrl for my hobby ide BUT when i right click on an item to 'select item and show menu' even though the carat is on the new item the control reports the active TREEVIEWITEM is the previously selected item and the menu acts on the prev selected item. With listboxes its easy you just subclass the ctrl and simulate "press lmb down and lmb up" when rmb is pressed but this method doesnt work at all with treeviews. How do i select a item with the rmb? Ps. you can be technical with your responce, im v.familiar w/ winapi. :) thx bob Sorry guys lol. Just solved it. You use the TVM_HITTEST to get the current item under the mouse cursor then call TVM_SELECTITEM w/ that item. Then call trackpopupmenu as normal. 4 hours wasted last night on that one... still happy ending. ;)

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      What messages or notifications are you responding to?

      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