the only time I seem to get a handle for a treeview item is when it is selected or being selected...
is there a way to get the handle to one that is clicked and/or right-clicked selected or not?
.elseif [edi].NMTREEVIEW.hdr.code == NM_RCLICK
dec fSel ; flag to bypass TVN_SELCHANGED
invoke GetCursorPos, addr mousePos
m2m tvhit.pt.x, mousePos.x ; [edi].NMTREEVIEW.ptDrag.x ; niether works
m2m tvhit.pt.y, mousePos.y ; [edi].NMTREEVIEW.ptDrag.y ; " "
m2m tvhit.flags, TVHT_ONITEM
invoke SendMessage, hTV, TVM_HITTEST, 0, addr tvhit
invoke SendMessage, hTV, TVM_SELECTITEM, TVGN_CARET, tvhit.hItem
invoke LoadMenu, hInstance, IDI_TREEMENU
invoke GetSubMenu, eax, 0
mov hpum, eax
invoke GetCursorPos, addr mousePos
invoke TrackPopupMenu, hpum, TPM_LEFTALIGN or TPM_RIGHTBUTTON, mousePos.x, mousePos.y, 0, hTV, NULL
invoke DestroyMenu, hpum
inc fSel
.endif
thanx,
DC
Is this what you want?
[edi].NMTREEVIEW.itemOld.hItem
[edi].NMTREEVIEW.itemOld.hItem
[edi].NMTREEVIEW.itemNew.hItem
that gives me 'previously selected hItem', 'previously selected hItem', 'currently selected hItem'...
I want 'currently clicked hItem'
[edit]
clicking on all-ready selected items doesn't seem to varify that action,
right clicks don't seem to give up any hItem info either - selected or not
Try this example..
The useful thing for you will be the TreeGetItemClicked function - which works wether or not the item has actually been clicked (but I only call it upon a click)
[attachment deleted by admin]
ah,ha!
it was ScreenToClient that I was missing, sure would be nice to have a list of cool trick functions... like one I accidently stumbled on, I don't even know how...
PathAddBackslash - very nice function... alot of the cool ones I'm not even aware of...
anyway, this works now, thanx again Tedd
.elseif [edi].NMTREEVIEW.hdr.code == NM_RCLICK
dec fSel ; flag to bypass TVN_SELCHANGED
invoke GetCursorPos, addr tvhit.pt
invoke ScreenToClient, hTV, addr tvhit.pt
mov tvhit.flags, TVHT_ONITEM
invoke SendMessage, hTV, TVM_HITTEST, 0, addr tvhit
invoke SendMessage, hTV, TVM_SELECTITEM, TVGN_CARET, eax ; tvhit.hItem
invoke LoadMenu, hInstance, IDI_TREEMENU
invoke GetSubMenu, eax, 0
mov hpum, eax
invoke GetCursorPos, addr mousePos
invoke TrackPopupMenu, hpum, TPM_LEFTALIGN or TPM_RIGHTBUTTON, mousePos.x, mousePos.y, 0, hTV, NULL
invoke DestroyMenu, hpum
inc fSel
.endif