Tree view Question
-
Hi All! I want on a tree control (under Win32 SDK) to retrieve item text by using NM_CLICK notification. The problem i have is when I use NM_CLICK I retrieve NULL at HTREEITEM handle (I checked with NM_DBLCLK and i retrieved a handle). would it be good idea to use TVHITTESTINFO with TreeView_HitTest? The code is: ... case NM_CLICK { char str[32]; int ret = 0; TV_ITEM item; HTREEITEM hItem = NULL; // Get next selected item // When i use NM_DBLCLK hItem is not NULL<------- hItem = (HTREEITEM)TreeView_GetNextItem(hTree, hItem, TVGN_CARET); if (hItem == NULL) ret = 0; item.mask = TVIF_TEXT; item.cchTextMax= 32; item.pszText= str; item.hItem = hItem; if (!TreeView_GetItem(hTree, &item)) ret = -1; } Thanks
-
Hi All! I want on a tree control (under Win32 SDK) to retrieve item text by using NM_CLICK notification. The problem i have is when I use NM_CLICK I retrieve NULL at HTREEITEM handle (I checked with NM_DBLCLK and i retrieved a handle). would it be good idea to use TVHITTESTINFO with TreeView_HitTest? The code is: ... case NM_CLICK { char str[32]; int ret = 0; TV_ITEM item; HTREEITEM hItem = NULL; // Get next selected item // When i use NM_DBLCLK hItem is not NULL<------- hItem = (HTREEITEM)TreeView_GetNextItem(hTree, hItem, TVGN_CARET); if (hItem == NULL) ret = 0; item.mask = TVIF_TEXT; item.cchTextMax= 32; item.pszText= str; item.hItem = hItem; if (!TreeView_GetItem(hTree, &item)) ret = -1; } Thanks
There's no item associated with the NM_CLICK notification. NM_CLICK (treeview): "Notifies the parent window of a tree-view control that the user has clicked the left mouse button within the control" What are you trying to do? Which item do you expect to get when the user clicks the control? Mark
Mark Salsbery Microsoft MVP - Visual C++ :java: