Treeview right click

Archives Forums/Win32 Discussion/Treeview right click

Picklesworth(Posted 2005) [#1]
Yay! A problem, and it's all Windows' fault!
Thanks to Kev, I now have popup menus working. However, I still have a problem -- To get them to display, I have to tell Windows to do so myself. I have to call TrackPopupMenu when my program recieves a WM_RButtonUp message. I hope that I am wrong. If I am wrong, please correct me.
The problem with using WM_RButtonUp to solve my problem is because, for some stupid reason known only by satan himself, treeviews do not recieve WM_RButtonUp messages whenever they happen. (Generally I have to right click a few times really fast. No, it is not a double-click message). They do, however, always recieve WM_LButtonUp messages whenever they happen.
So, I need any of the following:
- A simple way to recieve a WM_RBUTTONUP message, whenever it happens, with a treeview.
- A way to tell Windows that a popup menu belongs to a gadget, so that I do not need to pop it up myself.
- A message that is sent to a window to tell it to open a popup menu.

Picklesworth(Posted 2005) [#2]
MSDN has, by far, the worst documentation I have ever seen.
I found that constant only because it was mentioned quietly in a single article that I happened to come across in a search through a hundred forum discussions with the same problem as me. If context menus didn't have three names, this wouldn't have taken so long. To select the tree node when it's right clicked, I do this:
apiSendMessage EventSource(),WM_LBUTTONDOWN,0,PeekInt(WinProcReturn,$0C)

Still won't do right-click with that function, (so so far the only proper context menu I'm getting is done with the menu key on the keyboard) but the explanation is here:

I think MS made treeviews like this for publicity...

Kev(Posted 2005) [#3]
this could be done using NM_RCLICK the notification message notifies the parent window of a right click event, its recived under the WM_NOTIFY and obtained from NMHDR structure, ie. pnmh = (NMHDR FAR *) lParam; NMHDR still needs fixing under winblitz3d.