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. Issue using CTreeCtrl with Checkboxes and SetCheck()

Issue using CTreeCtrl with Checkboxes and SetCheck()

Scheduled Pinned Locked Moved C / C++ / MFC
helpdata-structures
2 Posts 1 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.
  • F Offline
    F Offline
    flippydeflippydebop
    wrote on last edited by
    #1

    Hello there.. I have a CTreeCtrl which has the checkboxes style set. I would like all the checkboxes to be set (ticked) by default. I have function which loops around all the tree items and calls SetCheck() on each tree item. However when calling this function from inside OninitDialog the checkboxes do not get set. If i call this function afer the OninitDialog it works fine. Can anyone help me here.

    F 1 Reply Last reply
    0
    • F flippydeflippydebop

      Hello there.. I have a CTreeCtrl which has the checkboxes style set. I would like all the checkboxes to be set (ticked) by default. I have function which loops around all the tree items and calls SetCheck() on each tree item. However when calling this function from inside OninitDialog the checkboxes do not get set. If i call this function afer the OninitDialog it works fine. Can anyone help me here.

      F Offline
      F Offline
      flippydeflippydebop
      wrote on last edited by
      #2

      ahh-haa... i have found the reason http://groups.google.co.uk/group/microsoft.public.vc.mfc/browse_thread/thread/2ae2e6583698ac21/481e981ec4591749[^] "This is a weird idiosyncracy of the tree control. It's mentioned in the Platform SDK docs under the topic "Tree View Control Window Styles": "If you want to use this style, you must set the TVS_CHECKBOXES style with SetWindowLong after you create the treeview control, and before you populate the tree. Otherwise, the checkboxes might appear unchecked, depending on timing issues. "

      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