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. CTreeCtrl related problem

CTreeCtrl related problem

Scheduled Pinned Locked Moved C / C++ / MFC
data-structureshelp
3 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.
  • H Offline
    H Offline
    harsha_1234
    wrote on last edited by
    #1

    Hi all, i have one class in which i create tree view control with it's Create method. e.g class CDocTree : CSizingbar { public : CTreeCtrl m_wndTreeCtrl; }; in this way i am working till now but i am not able to know when someone right clicks on the node. actually i want to do something like this if somebody right clicks on leaf node then i want to display a popup menu at that position and then on some menu event i wanted to show the dialog box. in this process i want the label associated with that leaf node.. currently i am catching events in this manner BEGIN_MESSAGE_MAP(CDocTree, CSizingDocBar) ON_WM_CREATE() ON_NOTIFY(NM_DBLCLK,1234,OnTreeNotify)//** ON_NOTIFY(TVN_KEYDOWN, 1234, OnTreeKeyDown)//** ON_WM_CONTEXTMENU() END_MESSAGE_MAP() how i can achieve it Thanks and regards Harshal

    M P 2 Replies Last reply
    0
    • H harsha_1234

      Hi all, i have one class in which i create tree view control with it's Create method. e.g class CDocTree : CSizingbar { public : CTreeCtrl m_wndTreeCtrl; }; in this way i am working till now but i am not able to know when someone right clicks on the node. actually i want to do something like this if somebody right clicks on leaf node then i want to display a popup menu at that position and then on some menu event i wanted to show the dialog box. in this process i want the label associated with that leaf node.. currently i am catching events in this manner BEGIN_MESSAGE_MAP(CDocTree, CSizingDocBar) ON_WM_CREATE() ON_NOTIFY(NM_DBLCLK,1234,OnTreeNotify)//** ON_NOTIFY(TVN_KEYDOWN, 1234, OnTreeKeyDown)//** ON_WM_CONTEXTMENU() END_MESSAGE_MAP() how i can achieve it Thanks and regards Harshal

      M Offline
      M Offline
      Mila025
      wrote on last edited by
      #2

      Hi, Try to ON_NOTIFY( NM_RCLICK, IDC_TREE, OnRclickOnTree ) in OnRclickOnTree, You can send WM_CONTEXTMENU message.

      ----------- Mila

      1 Reply Last reply
      0
      • H harsha_1234

        Hi all, i have one class in which i create tree view control with it's Create method. e.g class CDocTree : CSizingbar { public : CTreeCtrl m_wndTreeCtrl; }; in this way i am working till now but i am not able to know when someone right clicks on the node. actually i want to do something like this if somebody right clicks on leaf node then i want to display a popup menu at that position and then on some menu event i wanted to show the dialog box. in this process i want the label associated with that leaf node.. currently i am catching events in this manner BEGIN_MESSAGE_MAP(CDocTree, CSizingDocBar) ON_WM_CREATE() ON_NOTIFY(NM_DBLCLK,1234,OnTreeNotify)//** ON_NOTIFY(TVN_KEYDOWN, 1234, OnTreeKeyDown)//** ON_WM_CONTEXTMENU() END_MESSAGE_MAP() how i can achieve it Thanks and regards Harshal

        P Offline
        P Offline
        Parthi_Appu
        wrote on last edited by
        #3

        Check the WM_CONTEXTMENU is called for your tree control. then check the point where right clicked (lParam value has the point)has any item,.. the handle to the tree will be passed in wParam if so then check it is leaf node (by checking its child you can find out). Show your context menu and handle occrdingly.. Hope this'll help...

        Do your Duty and Don't expect the Result

        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