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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. Event notification from checkbox within TreeControl (from WTL)

Event notification from checkbox within TreeControl (from WTL)

Scheduled Pinned Locked Moved ATL / WTL / STL
c++question
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.
  • S Offline
    S Offline
    shivonkar
    wrote on last edited by
    #1

    I have CheckBox in TreeControl (from WTL). Please let me know how can i receive Event notification from checkbox when it is selected/unselected. I tried LButtonDOwm and OnClick but it does not work. For LButtonDOwn i used NOTIFY_HANDLER(IID_TC, WM_LBUTTONDOWN, OnLButtonDown) but control does not come to this. For click i am unable to detect on which item was clicked. NOTIFY_HANDLER(IID_TC, NM_CLICK, OnClick) Thanks Shiv

    A 1 Reply Last reply
    0
    • S shivonkar

      I have CheckBox in TreeControl (from WTL). Please let me know how can i receive Event notification from checkbox when it is selected/unselected. I tried LButtonDOwm and OnClick but it does not work. For LButtonDOwn i used NOTIFY_HANDLER(IID_TC, WM_LBUTTONDOWN, OnLButtonDown) but control does not come to this. For click i am unable to detect on which item was clicked. NOTIFY_HANDLER(IID_TC, NM_CLICK, OnClick) Thanks Shiv

      A Offline
      A Offline
      algol
      wrote on last edited by
      #2

      Place the following code into OnClick: #define MSG_CHECKSTATECHANGE (WM_USER + 1001) DWORD dwpos = GetMessagePos(); TVHITTESTINFO ht; ht.pt.x = GET_X_LPARAM(dwpos); ht.pt.y = GET_Y_LPARAM(dwpos); ::MapWindowPoints(HWND_DESKTOP, pnmh->hwndFrom, &ht.pt, 1); ::TreeView_HitTest(lpnm->hwndFrom, &ht); // If click on checkbox then post user defined message if(TVHT_ONITEMSTATEICON & ht.flags) { PostMessage(MSG_CHECKSTATECHANGE, 0, (LPARAM)ht.hItem); } You can also send the MSG_CHECKSTATECHANGE message from TVN_KEYDOWN notify handler when SPACE key is pressed.

      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