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