News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

get treeview node after right click

Started by egons, May 19, 2011, 11:01:30 AM

Previous topic - Next topic

egons

how do i get node after user mouse button  right click?

fearless

NM_RCLICK http://msdn.microsoft.com/en-us/library/bb773484%28v=vs.85%29.aspx which uses NMHDR http://msdn.microsoft.com/en-us/library/bb775514%28v=vs.85%29.aspx

and then you can use TVM_GETNEXTITEM http://msdn.microsoft.com/en-us/library/bb773622%28v=VS.85%29.aspx with TVGN_CARET to get currently selected item

Not sure if the below code is 100% accurate, modified it based on a right click for a listview, which has similar messages, but should give you and idea how to proceed hopefully :D

.ELSEIF eax==WM_NOTIFY
mov edi,lParam
assume edi:ptr NMHDR
mov eax,[edi].hwndFrom
.if eax==hTreeview
mov eax, [edi].code
.if eax == NM_RCLICK ; right click popup
Invoke SendMessage, hTreeview , TVM_GETNEXTITEM, TVGN_CARET, 0

Ć’earless

egons

well, but... looks like mouse right click didn't move selection(caret) to new node :bdg

egons

            invoke SendMessage,hwndTreeView,TVM_GETNEXTITEM,TVGN_DROPHILITE,0;TVM_SELECTITEM,TVGN_CARET,eax
; possible eax=0
            invoke SendMessage,hwndTreeView,TVM_SELECTITEM,TVGN_CARET,eax

pretty nice, eh?