Hi to all!

How to detect the name of selected item in TreeView control? E.g. I there only 3 items named as Red, Green and Blue and one of it double clicked.

Posted on 2003-03-18 06:53:18 by Mike
Process the message TVN_SELCHANGED. Then you check that the value of itemNew.pszText is equal to the one that you need, ie using lstrcmp.
Posted on 2003-03-18 06:59:34 by roticv
Sorry but it seems to me that you understand me not properly. TVN_SELCHANGED is notification message, so I can't send it but only recieve it. E.g.
.elseif wmsg==WM_NOTIFY
mov edi,lparam
assume edi:ptr NM_TREEVIEW
.if .hdr.code==TVN_SELCHANGED
invoke MessageBox, 0, .itemNew.pszText, .itemOld.pszText, 0

That's my question. When I doubleclick some item, e.g.
I must SEND one or more messages, e.g.
invoke SendMessage, hwnd, TVM_GETNEXTITEM, -1, LVNI_SELECTED
to detect name of item (or index). In other words: what messages must I sent after double clicking to do this?

Posted on 2003-03-18 10:16:51 by Mike
I have found only one method to identify the selected item. I save
handles of all items and then compare it:
invoke SendMessage, hwnd, TVM_GETNEXTITEM, TVGN_CARET, 0
mov hCurrent, eax
.if eax==hParent
invoke MessageBox, 0, offset Parent, offset Selected, 0
.elseif eax==hRed
Program works properly but I don't know what I must do if ther will be
100 or more inserted items...


P.S. See attached program
Posted on 2003-03-19 06:53:34 by Mike