News:

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

Treeview item -> get handle?

Started by DC, January 23, 2006, 01:22:56 AM

Previous topic - Next topic

DC

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
this isn't daja vu, I'm just learning it for the 37th time
http://www.bmath.net

zooba

Is this what you want?

[edi].NMTREEVIEW.itemOld.hItem
[edi].NMTREEVIEW.itemOld.hItem
[edi].NMTREEVIEW.itemNew.hItem

DC

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
this isn't daja vu, I'm just learning it for the 37th time
http://www.bmath.net

Tedd

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]
No snowflake in an avalanche feels responsible.

DC

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
this isn't daja vu, I'm just learning it for the 37th time
http://www.bmath.net