Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Tree view Question

Tree view Question

Scheduled Pinned Locked Moved C / C++ / MFC
questiondata-structureshelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dennis L
    wrote on last edited by
    #1

    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

    M 1 Reply Last reply
    0
    • D Dennis L

      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

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      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:

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups