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